Class: Cfg

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

Class Method Summary collapse

Class Method Details

.cfgObject



11
12
13
# File 'lib/utils/cfg.rb', line 11

def cfg
  @cfg ||= Cfg.load
end

.loadObject



15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/utils/cfg.rb', line 15

def load
  cfg =  File.expand_path($options[:config])
  env = $options[:env]
  hash = YAML.load(File.open(cfg))[env]
  hash.each do |k,v|
    hash[k] = v.to_i if v =~ /^\d+$/
  end
  obj = OpenStruct.new hash
  obj.new_nginx_conf = "#{obj.nginx_conf}.new"

  @cfg = obj
end

.method_missing(method_sym, *arguments, &block) ⇒ Object



7
8
9
# File 'lib/utils/cfg.rb', line 7

def method_missing(method_sym, *arguments, &block)
  cfg.send(method_sym, *arguments, &block)
end