Class: GS1::SyntaxDictionary::Parser

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

Overview

Parser for the GS1 syntax dictionary.

The latest version of the syntax dictionary is available at: ref.gs1.org/tools/gs1-barcode-syntax-resource/syntax-dictionary.

The syntax dictionary has been copied to gs1-syntax-dictionary.txt. The format of the syntax dictionary is available at the top of the dictionary.

Defined Under Namespace

Modules: StringHelpers Classes: ColumnPatterns, Entry

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ Parser

Returns a new instance of Parser.

Parameters:

  • data (String)

    the syntax dictionary data to parse



49
50
51
# File 'lib/gs1/syntax_dictionary/parser.rb', line 49

def initialize(data)
  @data = data
end

Instance Method Details

#parseArray<Entry>

Parses the syntax dictionary data and returns a list of dictionary entries.

Returns:

  • (Array<Entry>)

    a list of syntax dictionary entries



57
# File 'lib/gs1/syntax_dictionary/parser.rb', line 57

def parse = entry_lines.flat_map { parse_line(_1) }