class ThreeScaleToolbox::Configuration

Attributes

config_file[R]

Public Class Methods

new(config_file) click to toggle source
# File lib/3scale_toolbox/configuration.rb, line 7
def initialize(config_file)
  @config_file = config_file
  @store = YAML::Store.new(config_file)
end

Public Instance Methods

data(key) click to toggle source
# File lib/3scale_toolbox/configuration.rb, line 12
def data(key)
  read[key]
end
update(key) { |store| ... } click to toggle source
# 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

Private Instance Methods

read() click to toggle source

returns copy of data stored

# File lib/3scale_toolbox/configuration.rb, line 27
def read
  @store.transaction(true) do
    @store.roots.each_with_object({}) do |key, obj|
      obj[key] = @store[key]
    end
  end
end