Class: Configuration
- Inherits:
-
Object
show all
- Includes:
- Singleton
- Defined in:
- lib/bottlerocket/models/configuration.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(field, *args) ⇒ Object
40
41
42
43
44
45
46
47
48
49
50
|
# File 'lib/bottlerocket/models/configuration.rb', line 40
def method_missing(field, *args)
begin
if environments.include? field.to_s
ConnectionHelper.new attrs[field.to_s]
else
attrs[field.to_s]
end
rescue
super(field, *args)
end
end
|
Instance Attribute Details
#config_file_location ⇒ Object
Returns the value of attribute config_file_location.
26
27
28
|
# File 'lib/bottlerocket/models/configuration.rb', line 26
def config_file_location
@config_file_location
end
|
Instance Method Details
#attrs ⇒ Object
28
29
30
|
# File 'lib/bottlerocket/models/configuration.rb', line 28
def attrs
@attrs ||= YAML.load_file config_file_location
end
|
#content_types ⇒ Object
36
37
38
|
# File 'lib/bottlerocket/models/configuration.rb', line 36
def content_types
@content_types ||= ContentTypes.load(content_types_file)
end
|
#environments ⇒ Object
32
33
34
|
# File 'lib/bottlerocket/models/configuration.rb', line 32
def environments
%w(development test staging production)
end
|