Class: Configgler::Config::ConfigElement

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config, element) ⇒ ConfigElement

Returns a new instance of ConfigElement.



34
35
36
37
# File 'lib/configgler/config.rb', line 34

def initialize(config,element)
    @element = config[element.to_s]
    self
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name) ⇒ Object



39
40
41
42
# File 'lib/configgler/config.rb', line 39

def method_missing(name)
    el = ConfigElement.new(@element,name.to_s)
    el.is_a?(Hash) ? el : el.value
end

Instance Attribute Details

#elementObject

Returns the value of attribute element.



32
33
34
# File 'lib/configgler/config.rb', line 32

def element
  @element
end

Instance Method Details

#valueObject



44
45
46
# File 'lib/configgler/config.rb', line 44

def value
    @element
end