Module: Configur

Defined in:
lib/configur.rb

Overview

Configur module

Constant Summary collapse

VERSION =

Version constant

[1, 0, 0].join '.'

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.set_config(name, value) ⇒ Object

Set a config value



36
37
38
# File 'lib/configur.rb', line 36

def self.set_config(name, value)
  @@_configur_data[name.to_sym] = value
end

Instance Method Details

#configur {|block| ... } ⇒ Object

Configur

Yields:

  • (block)


14
15
16
17
18
19
20
21
22
23
# File 'lib/configur.rb', line 14

def configur(&block)
  @@_configur_data ||= {}

  def block.method_missing(m, *args, &block)
    name = m.to_s.gsub '=', ''
    Configur.set_config name, args[0]
  end

  yield block
end

#get_config(name) ⇒ Object

Get a config value



31
32
33
# File 'lib/configur.rb', line 31

def get_config(name)
  @@_configur_data[name.to_sym] || nil
end

#get_configsObject

Get all configs



26
27
28
# File 'lib/configur.rb', line 26

def get_configs
  @@_configur_data || {}
end