class SnappyStats::Config
Attributes
namespace[RW]
raise_connection_errors[RW]
Public Class Methods
new(options = {})
click to toggle source
# File lib/snappy_stats/config.rb, line 7 def initialize(options = {}) # all keys are prefixed with this namespace @namespace = 'stats' # rescue Redis connection errors @raise_connection_errors = false end
Public Instance Methods
redis()
click to toggle source
Returns the Redis connection
# File lib/snappy_stats/config.rb, line 28 def redis @redis ||= Redis.new end
redis=(arg)
click to toggle source
Set the Redis connection to use
arg - A Redis connection or a Hash of Redis connection options
Returns the Redis client
# File lib/snappy_stats/config.rb, line 19 def redis=(arg) if arg.is_a? Redis @redis = arg else @redis = Redis.new(arg) end end