Class: CloudConfig::Providers::YamlFile
- Inherits:
-
Object
- Object
- CloudConfig::Providers::YamlFile
- Defined in:
- lib/cloud-config/providers/yaml_file.rb
Overview
A class for fetching configuration from the AWS Parameter Store
Instance Attribute Summary collapse
-
#contents ⇒ Object
readonly
Returns the value of attribute contents.
- #Contents of the Yaml file(oftheYamlfile) ⇒ Hash readonly
Instance Method Summary collapse
-
#get(key, _opts = {}) ⇒ Object
Fetch the value of the key.
-
#initialize(opts = {}) ⇒ YamlFile
constructor
Create an instance of YamlFile.
-
#set(key, value) ⇒ Object
Set the value of the key.
Constructor Details
#initialize(opts = {}) ⇒ YamlFile
Create an instance of CloudConfig::Providers::YamlFile
20 21 22 |
# File 'lib/cloud-config/providers/yaml_file.rb', line 20 def initialize(opts = {}) @contents = YAML.load_file(opts[:filename]) || {} end |
Instance Attribute Details
#contents ⇒ Object (readonly)
Returns the value of attribute contents.
14 15 16 |
# File 'lib/cloud-config/providers/yaml_file.rb', line 14 def contents @contents end |
#Contents of the Yaml file(oftheYamlfile) ⇒ Hash (readonly)
14 |
# File 'lib/cloud-config/providers/yaml_file.rb', line 14 attr_reader :contents |
Instance Method Details
#get(key, _opts = {}) ⇒ Object
Fetch the value of the key
29 30 31 |
# File 'lib/cloud-config/providers/yaml_file.rb', line 29 def get(key, _opts = {}) contents[key] end |
#set(key, value) ⇒ Object
Set the value of the key
37 38 39 |
# File 'lib/cloud-config/providers/yaml_file.rb', line 37 def set(key, value) @contents[key] = value end |