Class: Eancom::Parser::Document
- Inherits:
-
Object
- Object
- Eancom::Parser::Document
- Defined in:
- lib/eancom/parser/document.rb
Defined Under Namespace
Classes: SegmentTypeNotDefined
Instance Attribute Summary collapse
-
#document ⇒ Object
readonly
Returns the value of attribute document.
-
#file ⇒ Object
readonly
Returns the value of attribute file.
Instance Method Summary collapse
-
#initialize(file:) ⇒ Document
constructor
A new instance of Document.
- #parse ⇒ Object
Constructor Details
#initialize(file:) ⇒ Document
Returns a new instance of Document.
8 9 10 11 |
# File 'lib/eancom/parser/document.rb', line 8 def initialize(file:) @file = file @document = Eancom::Edifact::Document.new end |
Instance Attribute Details
#document ⇒ Object (readonly)
Returns the value of attribute document.
6 7 8 |
# File 'lib/eancom/parser/document.rb', line 6 def document @document end |
#file ⇒ Object (readonly)
Returns the value of attribute file.
6 7 8 |
# File 'lib/eancom/parser/document.rb', line 6 def file @file end |
Instance Method Details
#parse ⇒ Object
13 14 15 16 17 18 19 20 |
# File 'lib/eancom/parser/document.rb', line 13 def parse content.split(segment_delimiter).each do |segment_string| segment = Parser::Segment.new(segment_string) segment = segment.parse add(segment) end @document end |