Class: Khronos::Config
- Inherits:
-
Object
show all
- Includes:
- Singleton
- Defined in:
- lib/khronos/config.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args, &block) ⇒ Object
22
23
24
|
# File 'lib/khronos/config.rb', line 22
def method_missing(name, *args, &block)
self.get(name.to_s)
end
|
Instance Attribute Details
#settings ⇒ Object
Returns the value of attribute settings.
7
8
9
|
# File 'lib/khronos/config.rb', line 7
def settings
@settings
end
|
Instance Method Details
#get(key) ⇒ Object
14
15
16
|
# File 'lib/khronos/config.rb', line 14
def get(key)
@settings[key.to_s]
end
|
#load!(file_path, env = 'development') ⇒ Object
9
10
11
12
|
# File 'lib/khronos/config.rb', line 9
def load!(file_path, env='development')
@settings = YAML.load_file(file_path)[env]
ENV['KHRONOS_STORAGE'] = @settings['storage']
end
|
#set(key, value) ⇒ Object
18
19
20
|
# File 'lib/khronos/config.rb', line 18
def set(key, value)
@settings[key.to_s] = value
end
|