Class: RBEDI::Parser

Inherits:
Object
  • Object
show all
Defined in:
lib/rbedi/parser.rb

Instance Method Summary collapse

Constructor Details

#initialize(edi_data, fragment: false, separator: nil) ⇒ Parser

Returns a new instance of Parser.



3
4
5
6
7
# File 'lib/rbedi/parser.rb', line 3

def initialize(edi_data, fragment: false, separator: nil)
  @edi_data = edi_data
  @fragment = fragment
  @separator = separator
end

Instance Method Details

#parseObject



9
10
11
12
13
14
# File 'lib/rbedi/parser.rb', line 9

def parse
  segments = to_segments
  return segments.map{|s|Segment.parse(s, separator: @separator)} if @fragment

  generate_transaction(segments)
end