Module: KConfig

Defined in:
lib/korben/k_config.rb

Defined Under Namespace

Classes: KWrapper

Constant Summary collapse

@@_ran_once =

ensures the setup only gets run once

false
@@const_name =
"KSettings"

Class Method Summary collapse

Class Method Details

.load!(settings = {}) ⇒ Object



17
18
19
20
21
22
# File 'lib/korben/k_config.rb', line 17

def load!(settings = {})
  Kernel.send(:remove_const, KConfig.const_name) if Kernel.const_defined?(KConfig.const_name)
  k_wrapper = KConfig::KWrapper.new
  k_wrapper.load!(settings)
  Kernel.const_set(KConfig.const_name, k_wrapper)
end

.setup {|_self| ... } ⇒ Object

Yields:

  • (_self)

Yield Parameters:

  • _self (KConfig)

    the object that the method was called on



12
13
14
15
# File 'lib/korben/k_config.rb', line 12

def setup
  yield self if @@_ran_once == false
  @@_ran_once = true
end