Class: GS1::SyntaxDictionary::SpecificationParser
- Inherits:
-
Object
- Object
- GS1::SyntaxDictionary::SpecificationParser
- Defined in:
- lib/gs1/syntax_dictionary/specification_parser.rb
Overview
Parses the specification column.
Instance Method Summary collapse
-
#initialize(specification_data) ⇒ SpecificationParser
constructor
A new instance of SpecificationParser.
-
#parse ⇒ Range<Integer>
Returns the length.
Constructor Details
#initialize(specification_data) ⇒ SpecificationParser
Returns a new instance of SpecificationParser.
8 9 10 |
# File 'lib/gs1/syntax_dictionary/specification_parser.rb', line 8 def initialize(specification_data) @data = specification_data end |
Instance Method Details
#parse ⇒ Range<Integer>
Returns the length
13 14 15 16 17 18 19 |
# File 'lib/gs1/syntax_dictionary/specification_parser.rb', line 13 def parse lengths = components .map { parse_component(_1) } .reduce(Length.new(0, 0), :+) lengths.min..lengths.max end |