Skip to content

undefined method 'separator_chars' error when using default_msh: false #11

Description

@speckins
msg = SimpleHL7::Message.new default_msh: false
msg.msh[1] = '|'
msg.msh[2] = '^~\&'
puts msg.to_hl7

Results in:

~/.gem/ruby/2.7.1/gems/simple_hl7-1.0.2/lib/simple_hl7/message.rb:33:in `to_hl7': undefined method `separator_chars' for #<SimpleHL7::Segment:0x00007fe530845a90> (NoMethodError)

This is because #to_hl7 assumes that the MSH segment is the Segment subclass MSHSegment, which responds to #separator_chars.

I could solve this by explicitly instantiating an MSHSegment and using #append_segment, but it might be nicer if the Message class either defined an explicit #msh method or added an "MSH" clause to #method_missing that instantiated the subclass.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions