Module: Mutaconf

Defined in:
lib/mutaconf.rb,
lib/mutaconf/config.rb

Defined Under Namespace

Classes: Config

Constant Summary collapse

VERSION =
'0.2.0'

Class Method Summary collapse

Class Method Details

.config(*args, &block) ⇒ Object



17
18
19
# File 'lib/mutaconf.rb', line 17

def self.config *args, &block
  Config.find *args, &block
end

.config_file(*args, &block) ⇒ Object



21
22
23
# File 'lib/mutaconf.rb', line 21

def self.config_file *args, &block
  Config.find_file *args, &block
end

.env(*args) ⇒ Object



6
7
8
9
10
11
12
13
14
15
# File 'lib/mutaconf.rb', line 6

def self.env *args
  options = args.last.kind_of?(Hash) ? args.pop : {}
  args.flatten.inject({}) do |memo,key|
    env_key = options[:upcase] == false ? key.to_s : key.to_s.upcase
    prefix = options[:prefix]
    prefix = prefix.upcase if prefix and options[:upcase] != false
    memo[key.to_sym] = ENV["#{prefix}#{env_key}"]
    memo
  end
end