Sha256: e88c51bfec93a2314c0f0c88d85f5627bd1ea9e2b9085ed9dd72643bb6f1c208
Contents?: true
Size: 865 Bytes
Versions: 3
Compression:
Stored size: 865 Bytes
Contents
# Copyright (c) 2006 Michael Fellinger m.fellinger@gmail.com # All files in this distribution are subject to the terms of the Ruby license. require 'yaml/store' module Ramaze class YAMLStoreCache # create a new YAML::Store with the given file (which will be created if it # is not already there). def initialize(file = 'cache.yaml') @cache = YAML::Store.new(file) end # return the values for given keys. def values_at(*keys) transaction do |y| keys.map{|k| y[k]} end end # just a helper to use transactions. def transaction(&block) @cache.transaction do yield(@cache) end end # catch everything else and use a transaction to send it. def method_missing(*args, &block) transaction do |y| y.send(*args, &block) end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
ramaze-0.0.9 | lib/ramaze/cache/yaml_store.rb |
ramaze-0.0.8 | lib/ramaze/cache/yaml_store.rb |
ramaze-0.1.0 | lib/ramaze/cache/yaml_store.rb |