Method: Clian::Config::Element#initialize

Defined in:
lib/clian/config.rb

#initialize(hash = {}) ⇒ Element

Returns a new instance of Element.



79
80
81
82
83
84
85
86
87
# File 'lib/clian/config.rb', line 79

def initialize(hash = {})
  @original_hash = hash
  (hash || {}).each do |key, val|
    raise Clian::ConfigurationError, "config syntax error (#{key})" unless syntax.keyword?(key)
    var = syntax.instance_variable_name(key)
    obj = create_subnode(key, val)
    instance_variable_set(var, obj)
  end
end