Class: TemplateConfig

Inherits:
Object
  • Object
show all
Defined in:
lib/ccios/config.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(hash) ⇒ TemplateConfig

Returns a new instance of TemplateConfig.



59
60
61
62
63
64
65
66
67
68
69
# File 'lib/ccios/config.rb', line 59

def initialize(hash)
  @variables = hash["variables"] || {}
  @template_element_config = {}

  elements_variables = hash["elements_variables"] || {}
  raise "Invalid configuration, \"elements_variables\" should be a dictionary" unless elements_variables.is_a?(Hash)
  elements_variables.each do |key, hash|
    raise "Invalid element variable configuration for \"#{key}\"" unless hash.is_a?(Hash)
    @template_element_config[key] = TemplateElementConfig.new(hash)
  end
end

Instance Attribute Details

#variablesObject (readonly)

Returns the value of attribute variables.



57
58
59
# File 'lib/ccios/config.rb', line 57

def variables
  @variables
end

Instance Method Details

#element_configuration_for(element) ⇒ Object



71
72
73
# File 'lib/ccios/config.rb', line 71

def element_configuration_for(element)
  @template_element_config[element] || TemplateConfig.new({})
end