Class: Completely::PatternConfig

Inherits:
Object
  • Object
show all
Defined in:
lib/completely/pattern_config.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config) ⇒ PatternConfig

Returns a new instance of PatternConfig.



5
6
7
8
# File 'lib/completely/pattern_config.rb', line 5

def initialize(config)
  @options = config.delete('completely_options')&.transform_keys(&:to_sym) || {}
  @config = config
end

Instance Attribute Details

#configObject (readonly)

Returns the value of attribute config.



3
4
5
# File 'lib/completely/pattern_config.rb', line 3

def config
  @config
end

#optionsObject (readonly)

Returns the value of attribute options.



3
4
5
# File 'lib/completely/pattern_config.rb', line 3

def options
  @options
end

Instance Method Details

#flat_configObject

Raises:



22
23
24
# File 'lib/completely/pattern_config.rb', line 22

def flat_config
  raise Error, 'Pattern config cannot be converted to flat config'
end

#modelObject



10
11
12
13
14
15
16
17
18
19
20
# File 'lib/completely/pattern_config.rb', line 10

def model
  validate!

  @model ||= {
    program:  program,
    programs: programs,
    tree:     tree,
    options:  parsed_options,
    tokens:   tokens,
  }
end