Class: LightConfig::Configuration

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

Instance Method Summary collapse

Constructor Details

#initialize(&block) ⇒ Configuration

Returns a new instance of Configuration.



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/light_config.rb', line 3

def initialize(&block)
  @properties = {}
  ::LightConfig::Builder.new(self).instance_eval(&block)
  singleton = (class <<self; self; end)
  @properties.keys.each do |property|
    singleton.module_eval do
      define_method property do
        @properties[property]
      end

      define_method "#{property}=" do |value|
        @properties[property] = value
      end
    end
  end
end