Class: ThreeScaleToolbox::Configuration
- Inherits:
-
Object
- Object
- ThreeScaleToolbox::Configuration
- Defined in:
- lib/3scale_toolbox/configuration.rb
Instance Attribute Summary collapse
-
#config_file ⇒ Object
readonly
Returns the value of attribute config_file.
Instance Method Summary collapse
- #data(key) ⇒ Object
-
#initialize(config_file) ⇒ Configuration
constructor
A new instance of Configuration.
- #update(key) ⇒ Object
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_file ⇒ Object (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 |