module Hippo_eyeDoc::Parser::TransactionSet
Attributes
unparsed_data[RW]
Public Class Methods
new(options={})
click to toggle source
Calls superclass method
# File lib/hippo_eyeDoc/parser/transaction_set.rb, line 6 def initialize(options={}) super end
Public Instance Methods
find_first_segment(segments, identifier, reverse = false)
click to toggle source
# File lib/hippo_eyeDoc/parser/transaction_set.rb, line 10 def find_first_segment(segments, identifier, reverse = false) segments.reverse! if reverse if index = segments.index{|o| o.identifier == identifier} segments[index] else nil end end
parse(input)
click to toggle source
# File lib/hippo_eyeDoc/parser/transaction_set.rb, line 38 def parse(input) read(input) populate(parsed_segments) self end
parsed_segments()
click to toggle source
# File lib/hippo_eyeDoc/parser/transaction_set.rb, line 20 def parsed_segments @segments ||= @unparsed_data.split(@segment_separator).collect do |segment_string| segment_identifier = segment_string.split(@field_separator).first segment = Hippo_eyeDoc::Segments.const_get(segment_identifier.lstrip).new(:parent => self) segment.parse(segment_string) segment.to_s == '' ? nil : segment end.compact end
read(input = nil)
click to toggle source
# File lib/hippo_eyeDoc/parser/transaction_set.rb, line 31 def read(input = nil) input ||= '' @unparsed_data = input.gsub(/[\a\e\f\n\r\t\v]/,'') parse_separators(@unparsed_data) end