Class: EasyRedis::Redis

Inherits:
Object
  • Object
show all
Defined in:
lib/easy_redis/easy_redis.rb

Constant Summary collapse

@@redis =
nil
@@config =
{
  namespace: "easyredis",
  type_cast: true,
  redis: nil
}
@@valid_config_keys =
@@config.keys

Class Method Summary collapse

Class Method Details

.configure(opts = {}) ⇒ Object



34
35
36
37
38
39
# File 'lib/easy_redis/easy_redis.rb', line 34

def configure(opts = {})
  opts.each do |k,v|
    @@config[k.to_sym] = v if @@valid_config_keys.include? k.to_sym
  end
  self.redis = @@config[:redis] if @@config[:redis].present?
end

.namespaceObject



26
27
28
# File 'lib/easy_redis/easy_redis.rb', line 26

def namespace
  @@config[:namespace]
end

.redisObject



18
19
20
# File 'lib/easy_redis/easy_redis.rb', line 18

def redis
  @@redis
end

.redis=(redis) ⇒ Object



22
23
24
# File 'lib/easy_redis/easy_redis.rb', line 22

def redis=(redis)
  @@redis = redis
end

.use_type_casting?Boolean

Returns:

  • (Boolean)


30
31
32
# File 'lib/easy_redis/easy_redis.rb', line 30

def use_type_casting?
  @@config[:type_cast]
end