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.
8 9 10 11 |
# File 'lib/one_secret/secrets_yaml.rb', line 8 def initialize(path) @path = path @values = YAML.load(IO.read(path)) end |
Instance Attribute Details
#values ⇒ Object (readonly)
Returns the value of attribute values.
6 7 8 |
# File 'lib/one_secret/secrets_yaml.rb', line 6 def values @values end |
Instance Method Details
#save ⇒ Object
17 18 19 |
# File 'lib/one_secret/secrets_yaml.rb', line 17 def save File.write(@path, @values.to_yaml) end |
#set(environment, key, value) ⇒ Object
13 14 15 |
# File 'lib/one_secret/secrets_yaml.rb', line 13 def set(environment, key, value) @values[environment][key] = value end |