Class: OneSecret::SecretsYAML
- Inherits:
-
Object
- Object
- OneSecret::SecretsYAML
- Defined in:
- lib/one_secret/secrets_yaml.rb
Instance Attribute Summary collapse
-
#values ⇒ Object
readonly
Returns the value of attribute values.
Instance Method Summary collapse
-
#initialize(path) ⇒ SecretsYAML
constructor
A new instance of SecretsYAML.
- #save ⇒ Object
- #set(environment, key, value) ⇒ Object
Constructor Details
#initialize(path) ⇒ SecretsYAML
Returns a new instance of SecretsYAML.
7 8 9 10 |
# File 'lib/one_secret/secrets_yaml.rb', line 7 def initialize(path) @path = path @values = YAML.load(IO.read(path)) end |
Instance Attribute Details
#values ⇒ Object (readonly)
Returns the value of attribute values.
5 6 7 |
# File 'lib/one_secret/secrets_yaml.rb', line 5 def values @values end |
Instance Method Details
#save ⇒ Object
16 17 18 |
# File 'lib/one_secret/secrets_yaml.rb', line 16 def save File.write(@path, @values.to_yaml) end |
#set(environment, key, value) ⇒ Object
12 13 14 |
# File 'lib/one_secret/secrets_yaml.rb', line 12 def set(environment, key, value) @values[environment][key] = value end |