Sha256: aad5e338cd279f3bf0964c1af05d72a9529ffb08019b296e603f1b8049517d41
Contents?: true
Size: 757 Bytes
Versions: 7
Compression:
Stored size: 757 Bytes
Contents
module Boned class Model < Storable def self.key(*el) raise "#{self}: nil keypart: #{el.inspect}" if el.size != el.compact.size a = "v1::#{self}" a << ':' << el.join(':') unless el.empty? a end def self.redis Boned.redis end def self.primarykey(v=nil) unless v.nil? @primarykey = v class_eval do def primarykey() send(self.class.primarykey) end end end @primarykey end def redis self.class.redis end def save redis.sadd(self.class.key(kind, :all), self.primarykey) && redis.set(key(:created), self.time.to_i) && redis.set(key(:object), to_json) end end end Boned.require_glob 'boned', 'models', '*.rb'
Version data entries
7 entries across 7 versions & 1 rubygems