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.
Results in:
This is because
#to_hl7assumes that the MSH segment is theSegmentsubclassMSHSegment, which responds to#separator_chars.I could solve this by explicitly instantiating an
MSHSegmentand using#append_segment, but it might be nicer if theMessageclass either defined an explicit#mshmethod or added an "MSH" clause to#method_missingthat instantiated the subclass.