class Eancom::Edifact::Item
Attributes
hash[RW]
Public Class Methods
new()
click to toggle source
# File lib/eancom/edifact/item.rb, line 7 def initialize() @hash = {} end
Public Instance Methods
<<(segment)
click to toggle source
# File lib/eancom/edifact/item.rb, line 11 def << (segment) if name = group_name(segment) @hash[name] = [] if @hash[name].nil? @hash[name] << segment.to_json_hash else @hash.merge!(segment.to_json_hash) end end
empty?()
click to toggle source
# File lib/eancom/edifact/item.rb, line 24 def empty? @hash.empty? end
to_json_hash()
click to toggle source
# File lib/eancom/edifact/item.rb, line 20 def to_json_hash @hash end
Private Instance Methods
group_name(segment)
click to toggle source
# File lib/eancom/edifact/item.rb, line 30 def group_name(segment) if segment.item_group_name segment.item_group_name else segment.group_name end end