Class: Cluster::Configuration
- Inherits:
-
Object
- Object
- Cluster::Configuration
- Includes:
- Logging
- Defined in:
- lib/cluster/configuration.rb
Constant Summary collapse
- @@system_config =
{}
- @@credentials =
nil
Class Method Summary collapse
- .[](key) ⇒ Object
- .[]=(key, value) ⇒ Object
- .credentials ⇒ Object
- .credentials? ⇒ Boolean
- .method_missing(meth, *params) ⇒ Object
- .options(params = nil) ⇒ Object
Methods included from Logging
Class Method Details
.[](key) ⇒ Object
33 34 35 |
# File 'lib/cluster/configuration.rb', line 33 def [](key) @@system_config[key.to_s] end |
.[]=(key, value) ⇒ Object
29 30 31 |
# File 'lib/cluster/configuration.rb', line 29 def []=(key, value) @@system_config[key.to_s] = value end |
.credentials ⇒ Object
25 26 27 |
# File 'lib/cluster/configuration.rb', line 25 def credentials @@credentials ||= credentials? && File.open(self[:credentials_file]) {|f| YAML::load(f) } end |
.credentials? ⇒ Boolean
21 22 23 |
# File 'lib/cluster/configuration.rb', line 21 def credentials? self[:credentials_file] end |
.method_missing(meth, *params) ⇒ Object
37 38 39 40 41 42 43 44 |
# File 'lib/cluster/configuration.rb', line 37 def method_missing(meth, *params) field = meth.to_s if .respond_to? field .send(field) else super end end |
.options(params = nil) ⇒ Object
46 47 48 |
# File 'lib/cluster/configuration.rb', line 46 def (params = nil) @@system_config ||= self.new(params) end |