Sha256: 00382e1ee2f147bad6eb099c0e6d364895c5834e2e288cc88b6caacbd84d1782
Contents?: true
Size: 859 Bytes
Versions: 2
Compression:
Stored size: 859 Bytes
Contents
module Jaysus module Local def self.store_dir @store_dir ||= Pathname.new('.') end def self.store_dir=(dir) @store_dir = Pathname.new(dir) end def self.included(base) base.extend(ClassMethods) end def destroy super do store_file.delete self end end def save super do store_file.open('w') do |file| file.write(self.to_json) end self end end module ClassMethods def all # debugger if self.model_name == 'Kalipso::Site' records = [] Dir[store_file_dir.join('*')].each do |id| records << find(id) end records end def find(id) super do store_file_dir.join("#{id}").read end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
jaysus-0.1.3 | lib/jaysus/local.rb |
jaysus-0.1.2 | lib/jaysus/local.rb |