Class: Wildcloud::Configuration::SimpleBackend

Inherits:
Object
  • Object
show all
Defined in:
lib/wildcloud/configuration.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#configurationObject (readonly)

Returns the value of attribute configuration.



26
27
28
# File 'lib/wildcloud/configuration.rb', line 26

def configuration
  @configuration
end

#sourcesObject (readonly)

Returns the value of attribute sources.



26
27
28
# File 'lib/wildcloud/configuration.rb', line 26

def sources
  @sources
end