Class: Highway::Compiler::Parse::Versions::V1

Inherits:
Object
  • Object
show all
Defined in:
lib/highway/compiler/parse/versions/v1.rb

Overview

This class is responsible for parsing a configuration file v1.

Instance Method Summary collapse

Constructor Details

#initialize(interface:) ⇒ V1

Initialize an instance.

Parameters:



21
22
23
# File 'lib/highway/compiler/parse/versions/v1.rb', line 21

def initialize(interface:)
  @interface = interface
end

Instance Method Details

#parse(raw:) ⇒ Highway::Compiler::Parse::Tree::Root

Parse the configuration file v1.

Parameters:

  • raw (Hash)

    Raw content of configuration file.

Returns:



30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/highway/compiler/parse/versions/v1.rb', line 30

def parse(raw:)

  parse_tree = Parse::Tree::Root.new(version: 1)

  validate_toplevel_keys(raw: raw)

  parse_variables(raw: raw, parse_tree: parse_tree)
  parse_steps(raw: raw, parse_tree: parse_tree)

  parse_tree

end