| Class | X12::Loop |
| In: |
lib/X12/Loop.rb
|
| Parent: | Base |
Parse a string and fill out internal structures with the pieces of it. Returns an unparsed portion of the string or the original string if nothing was parsed out.
# File lib/X12/Loop.rb, line 47
47: def parse(str)
48: #puts "Parsing loop #{name}: "+str
49: s = str
50: nodes.each{|i|
51: m = i.parse(s)
52: s = m if m
53: }
54: if str == s
55: return nil
56: else
57: self.parsed_str = str[0..-s.length-1]
58: s = do_repeats(s)
59: end
60: #puts 'Parsed loop '+self.inspect
61: return s
62: end