Class: Cipherpipe::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/cipherpipe/configuration.rb

Constant Summary collapse

FILENAME =
".cipherpipe.yml"
UnknownFormatterError =
Class.new Cipherpipe::Error

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(filename = FILENAME) ⇒ Configuration

Returns a new instance of Configuration.



10
11
12
13
14
# File 'lib/cipherpipe/configuration.rb', line 10

def initialize(filename = FILENAME)
  @filename = filename

  parse!
end

Instance Attribute Details

#external_sourcesObject (readonly)

Returns the value of attribute external_sources.



8
9
10
# File 'lib/cipherpipe/configuration.rb', line 8

def external_sources
  @external_sources
end

#fileObject (readonly)

Returns the value of attribute file.



8
9
10
# File 'lib/cipherpipe/configuration.rb', line 8

def file
  @file
end

#formatObject (readonly)

Returns the value of attribute format.



8
9
10
# File 'lib/cipherpipe/configuration.rb', line 8

def format
  @format
end

Instance Method Details

#variablesObject



16
17
18
# File 'lib/cipherpipe/configuration.rb', line 16

def variables
  formatter.read File.read(file)
end

#variables=(hash) ⇒ Object



20
21
22
# File 'lib/cipherpipe/configuration.rb', line 20

def variables=(hash)
  File.write file, formatter.write(hash) if file
end