Sha256: c9488cfbabc23a202675619b24e210ec7490af713a8d345ff435a0581d9406d5
Contents?: true
Size: 575 Bytes
Versions: 9
Compression:
Stored size: 575 Bytes
Contents
require 'yaml/store' module Merb # thanks to Michael Fellinger from Ramaze class SimpleModel attr_accessor :db def initialize(filename = "#{DIST_ROOT}/schema/db.yaml") FileUtils.touch(filename) @db = YAML::Store.new(filename) end def method_missing(meth, *args, &block) @db.transaction do @db.send(meth, *args, &block) end end def [](key) @db.transaction do @db[key] end end def []=(key, value) @db.transaction do @db[key] = value end end end end
Version data entries
9 entries across 9 versions & 1 rubygems