Module: Raad::Configuration
Class Method Summary
collapse
Instance Method Summary
collapse
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(sym, *args) ⇒ Object
37
38
39
40
41
42
43
|
# File 'lib/raad/configuration.rb', line 37
def method_missing(sym, *args)
if sym.to_s =~ /(.+)=$/
config[$1] = args.first
else
config[sym]
end
end
|
Class Method Details
.init(&block) ⇒ Object
5
6
7
|
# File 'lib/raad/configuration.rb', line 5
def self.init(&block)
instance_eval(&block)
end
|
Instance Method Details
#[](key) ⇒ Object
9
10
11
|
# File 'lib/raad/configuration.rb', line 9
def [](key)
config[key]
end
|
#load(file = nil) ⇒ Nil
Loads a configuration file and eval its content in the service object context
17
18
19
20
|
# File 'lib/raad/configuration.rb', line 17
def load(file = nil)
return unless File.exists?(file)
self.instance_eval(IO.read(file))
end
|