Class: Redis::Wrap
- Inherits:
-
Object
- Object
- Redis::Wrap
- Defined in:
- lib/redis/wrap.rb
Instance Attribute Summary collapse
-
#key ⇒ Object
readonly
Returns the value of attribute key.
Instance Method Summary collapse
-
#initialize(key) ⇒ Wrap
constructor
A new instance of Wrap.
- #method_missing(command, *arguments, &block) ⇒ Object
- #redis ⇒ Object
Constructor Details
#initialize(key) ⇒ Wrap
Returns a new instance of Wrap.
9 10 11 |
# File 'lib/redis/wrap.rb', line 9 def initialize(key) @key = key end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(command, *arguments, &block) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/redis/wrap.rb', line 13 def method_missing(command, *arguments, &block) arguments = arguments.map do |argument| if argument.is_a?(Redis::Wrap) argument.key else argument end end redis.send(command, key, *arguments, &block) end |
Instance Attribute Details
#key ⇒ Object (readonly)
Returns the value of attribute key.
7 8 9 |
# File 'lib/redis/wrap.rb', line 7 def key @key end |
Instance Method Details
#redis ⇒ Object
25 26 27 |
# File 'lib/redis/wrap.rb', line 25 def redis Redis.current end |