lib/X12/Base.rb in X12-0.0.5 vs lib/X12/Base.rb in X12-0.1.0

- old
+ new

@@ -21,11 +21,11 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA #++ # module X12 - # $Id: Base.rb 35 2008-11-13 18:33:44Z ikk $ + # $Id: Base.rb 49 2009-03-17 19:46:08Z ikk $ # # Base class for Segment, Composite, and Loop. Contains setable # segment_separator, field_separator, and composite_separator fields. class Base @@ -58,9 +58,13 @@ def show(ind = '') count = 0 self.to_a.each{|i| #puts "#{ind}#{i.name} #{i.object_id} #{i.super.object_id} [#{count}]: #{i.parsed_str} #{i.super.class}" puts "#{ind}#{i.name} [#{count}]: #{i.to_s.sub(/^(.{30})(.*?)(.{30})$/, '\1...\3')}" + # Force parsing a segment + if i.kind_of?(X12::Segment) && i.nodes[0] + i.find_field(i.nodes[0].name) + end i.nodes.each{|j| case when j.kind_of?(X12::Base) : j.show(ind+' ') when j.kind_of?(X12::Field) : puts "#{ind+' '}#{j.name} -> '#{j.to_s}'" end