Class: GS1::SyntaxDictionary::SpecificationParser

Inherits:
Object
  • Object
show all
Defined in:
lib/gs1/syntax_dictionary/specification_parser.rb

Overview

Parses the specification column.

Instance Method Summary collapse

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

#parseRange<Integer>

Returns the length

Returns:

  • (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