Class: ButterCMS::DataStoreAdapters::Yaml

Inherits:
Object
  • Object
show all
Defined in:
lib/buttercms/data_store_adapters/yaml.rb

Instance Method Summary collapse

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(options)
  file_path = options.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