Class: Completely::PatternConfig
- Inherits:
-
Object
- Object
- Completely::PatternConfig
- Defined in:
- lib/completely/pattern_config.rb
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
- #flat_config ⇒ Object
-
#initialize(config) ⇒ PatternConfig
constructor
A new instance of PatternConfig.
- #model ⇒ Object
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
#config ⇒ Object (readonly)
Returns the value of attribute config.
3 4 5 |
# File 'lib/completely/pattern_config.rb', line 3 def config @config end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
3 4 5 |
# File 'lib/completely/pattern_config.rb', line 3 def @options end |
Instance Method Details
#flat_config ⇒ Object
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 |
#model ⇒ Object
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: , tokens: tokens, } end |