Sha256: 24849241689800b6560ce3166b7644ee2411c4c1ff406dcf2357728820ae8f73
Contents?: true
Size: 1.35 KB
Versions: 2
Compression:
Stored size: 1.35 KB
Contents
module Redistat module Model include Redistat::Database def self.included(base) base.extend(self) end def store(label, stats = {}, date = nil, meta = {}, opts = {}) Event.new(name, label, date, stats, options.merge(opts), meta).save end alias :event :store def connect_to(opts = {}) Connection.create(opts.merge(:ref => name)) options[:connection_ref] = name end def connection db(options[:connection_ref]) end alias :redis :connection def fetch(label, from, till, opts = {}) Finder.find({ :scope => name, :label => label, :from => from, :till => till }.merge(options.merge(opts))) end alias :lookup :fetch def hashed_label(boolean = nil) if !boolean.nil? options[:hashed_label] = boolean else options[:hashed_label] || nil end end def depth(depth = nil) if !depth.nil? options[:depth] = depth else options[:depth] || nil end end def store_event(boolean = nil) if !boolean.nil? options[:store_event] = boolean else options[:store_event] || nil end end def options @options ||= {} end private def name @name ||= self.to_s end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
redistat-0.0.6 | lib/redistat/model.rb |
redistat-0.0.5 | lib/redistat/model.rb |