Class: Eancom::Parser::Segment
- Inherits:
-
Object
- Object
- Eancom::Parser::Segment
- Defined in:
- lib/eancom/parser/segment.rb
Instance Attribute Summary collapse
-
#components ⇒ Object
Returns the value of attribute components.
-
#segment_class ⇒ Object
Returns the value of attribute segment_class.
-
#string ⇒ Object
Returns the value of attribute string.
-
#tag ⇒ Object
Returns the value of attribute tag.
Instance Method Summary collapse
-
#initialize(string) ⇒ Segment
constructor
A new instance of Segment.
- #parse ⇒ Object
Constructor Details
#initialize(string) ⇒ Segment
Returns a new instance of Segment.
7 8 9 10 11 12 |
# File 'lib/eancom/parser/segment.rb', line 7 def initialize(string) @string = string @components = [] @tag = una? ? 'UNA' : string.split(data_delimiter)[0] @segment_class = find_segment_class end |
Instance Attribute Details
#components ⇒ Object
Returns the value of attribute components.
5 6 7 |
# File 'lib/eancom/parser/segment.rb', line 5 def components @components end |
#segment_class ⇒ Object
Returns the value of attribute segment_class.
5 6 7 |
# File 'lib/eancom/parser/segment.rb', line 5 def segment_class @segment_class end |
#string ⇒ Object
Returns the value of attribute string.
5 6 7 |
# File 'lib/eancom/parser/segment.rb', line 5 def string @string end |
#tag ⇒ Object
Returns the value of attribute tag.
5 6 7 |
# File 'lib/eancom/parser/segment.rb', line 5 def tag @tag end |
Instance Method Details
#parse ⇒ Object
14 15 16 17 18 19 |
# File 'lib/eancom/parser/segment.rb', line 14 def parse parse_component klass = find_segment_class structure = find_structure klass.initialize_by_components(structure, @components) end |