Class: Wildcloud::Configuration::SimpleBackend
- Inherits:
-
Object
- Object
- Wildcloud::Configuration::SimpleBackend
- Defined in:
- lib/wildcloud/configuration.rb
Instance Attribute Summary collapse
-
#configuration ⇒ Object
readonly
Returns the value of attribute configuration.
-
#sources ⇒ Object
readonly
Returns the value of attribute sources.
Instance Method Summary collapse
-
#initialize(component) ⇒ SimpleBackend
constructor
A new instance of SimpleBackend.
Constructor Details
#initialize(component) ⇒ SimpleBackend
Returns a new instance of SimpleBackend.
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/wildcloud/configuration.rb', line 28 def initialize(component) @configuration ||= {} @sources = [ '/etc/wildcloud/wildcloud.yml', './wildcloud.yml', "/etc/wildcloud/#{component}.yml", "./#{component}.yml" ] @sources.delete_if do |file| not File.exist?(file) end @sources.each do |file| config = YAML.load_file(file) @configuration.merge!(config) if config end end |
Instance Attribute Details
#configuration ⇒ Object (readonly)
Returns the value of attribute configuration.
26 27 28 |
# File 'lib/wildcloud/configuration.rb', line 26 def configuration @configuration end |
#sources ⇒ Object (readonly)
Returns the value of attribute sources.
26 27 28 |
# File 'lib/wildcloud/configuration.rb', line 26 def sources @sources end |