Class: ThreeScaleToolbox::Configuration

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config_file) ⇒ Configuration

Returns a new instance of Configuration.



7
8
9
10
# File 'lib/3scale_toolbox/configuration.rb', line 7

def initialize(config_file)
  @config_file = config_file
  @store = YAML::Store.new(config_file)
end

Instance Attribute Details

#config_fileObject (readonly)

Returns the value of attribute config_file.



5
6
7
# File 'lib/3scale_toolbox/configuration.rb', line 5

def config_file
  @config_file
end

Instance Method Details

#data(key) ⇒ Object



12
13
14
# File 'lib/3scale_toolbox/configuration.rb', line 12

def data(key)
  read[key]
end

#update(key) ⇒ Object



16
17
18
19
20
21
22
# File 'lib/3scale_toolbox/configuration.rb', line 16

def update(key)
  return if key.nil?

  @store.transaction do
    @store[key] = yield @store[key]
  end
end