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.



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

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

#saveObject



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