Class: OneSecret::SecretsYAML

Inherits:
Object
  • Object
show all
Defined in:
lib/one_secret/secrets_yaml.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#valuesObject (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

#saveObject



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