Class: AllSeeingPi::Configuration
- Inherits:
-
Object
- Object
- AllSeeingPi::Configuration
- Defined in:
- lib/all_seeing_pi/configuration.rb
Instance Attribute Summary collapse
-
#aws_key ⇒ Object
Returns the value of attribute aws_key.
-
#aws_secret ⇒ Object
Returns the value of attribute aws_secret.
-
#redis_host ⇒ Object
Returns the value of attribute redis_host.
-
#redis_password ⇒ Object
Returns the value of attribute redis_password.
Instance Method Summary collapse
- #[](key) ⇒ Object
- #[]=(key, value) ⇒ Object
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #load_config_from_file(filename = 'all_seeing_pi.yml') ⇒ Object
- #reset! ⇒ Object
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
5 6 7 8 |
# File 'lib/all_seeing_pi/configuration.rb', line 5 def initialize reset! load_config_from_file end |
Instance Attribute Details
#aws_key ⇒ Object
Returns the value of attribute aws_key.
3 4 5 |
# File 'lib/all_seeing_pi/configuration.rb', line 3 def aws_key @aws_key end |
#aws_secret ⇒ Object
Returns the value of attribute aws_secret.
3 4 5 |
# File 'lib/all_seeing_pi/configuration.rb', line 3 def aws_secret @aws_secret end |
#redis_host ⇒ Object
Returns the value of attribute redis_host.
3 4 5 |
# File 'lib/all_seeing_pi/configuration.rb', line 3 def redis_host @redis_host end |
#redis_password ⇒ Object
Returns the value of attribute redis_password.
3 4 5 |
# File 'lib/all_seeing_pi/configuration.rb', line 3 def redis_password @redis_password end |
Instance Method Details
#[](key) ⇒ Object
16 17 18 |
# File 'lib/all_seeing_pi/configuration.rb', line 16 def [](key) send(key) end |
#[]=(key, value) ⇒ Object
20 21 22 |
# File 'lib/all_seeing_pi/configuration.rb', line 20 def []=(key, value) send("#{key}=", value) end |
#load_config_from_file(filename = 'all_seeing_pi.yml') ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/all_seeing_pi/configuration.rb', line 24 def load_config_from_file(filename = 'all_seeing_pi.yml') paths = [ "#{filename}", "config/#{filename}" ] config = {} paths.each do |filepath| config = YAML.load_file(filepath) if File.exists?(filepath) end config.each do |key, value| send("#{key}=", value) end end |
#reset! ⇒ Object
10 11 12 13 14 |
# File 'lib/all_seeing_pi/configuration.rb', line 10 def reset! instance_variables.each do |var| instance_variable_set(var, nil) end end |