Module: EasyRedis::Getters

Defined in:
lib/easy_redis/methods/getters.rb

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(meth, *args, &block) ⇒ Object



10
11
12
# File 'lib/easy_redis/methods/getters.rb', line 10

def method_missing(meth, *args, &block)
  (meth.to_s =~ /^redis_get_(.+)$/ || meth.to_s =~ /^r_get_(.+)$/) ? r_get($1, *args) : super
end

Instance Method Details

#r_get(attribute) ⇒ Object Also known as: redis_get



5
6
7
8
# File 'lib/easy_redis/methods/getters.rb', line 5

def r_get(attribute)
  val = self.redis_cli.hget(redis_key, attribute)
  self.use_type_casting? ? YAML.load(val.to_s) : val
end