tag = 'UNT' Eancom.register_segment(tag: tag, klass: Eancom::Edifact::UNT) structure = Eancom::Edifact::Structure.new(tag: tag) #============================================================================== # Tag # #============================================================================== tag = Eancom::Edifact::Composite.new() data = Eancom::Edifact::Data.new( type: String, length: 1..3, dictionary: nil, description: "Message Header", required: true ) tag.add(:tag, data) structure << tag #============================================================================== # Number of segments in the message # #============================================================================== number_of_segments_in_message = Eancom::Edifact::Composite.new() data = Eancom::Edifact::Data.new( type: String, length: 1..10, dictionary: nil, description: "Number of segments in the message", required: true ) number_of_segments_in_message.add(:number_of_segments_in_message, data) structure << number_of_segments_in_message #============================================================================== # Message reference number # #============================================================================== message_reference_number = Eancom::Edifact::Composite.new() data = Eancom::Edifact::Data.new( type: String, length: 1..14, dictionary: nil, description: "Message reference number", required: true ) message_reference_number.add(:message_reference_number, data) structure << message_reference_number #============================================================================== Eancom.register_structure(tag: 'UNT', structure: structure)