Class: ButterCMS::DataStoreAdapters::Yaml
- Inherits:
-
Object
- Object
- ButterCMS::DataStoreAdapters::Yaml
- Defined in:
- lib/buttercms/data_store_adapters/yaml.rb
Instance Method Summary collapse
- #get(key) ⇒ Object
-
#initialize(options) ⇒ Yaml
constructor
A new instance of Yaml.
- #set(key, value) ⇒ Object
Constructor Details
#initialize(options) ⇒ Yaml
Returns a new instance of Yaml.
6 7 8 9 10 |
# File 'lib/buttercms/data_store_adapters/yaml.rb', line 6 def initialize() file_path = .first @store = YAML::Store.new file_path end |
Instance Method Details
#get(key) ⇒ Object
18 19 20 21 22 |
# File 'lib/buttercms/data_store_adapters/yaml.rb', line 18 def get(key) @store.transaction do @store[key] end end |
#set(key, value) ⇒ Object
12 13 14 15 16 |
# File 'lib/buttercms/data_store_adapters/yaml.rb', line 12 def set(key, value) @store.transaction do @store[key] = value end end |