Class: Redis::Future
- Inherits:
- BasicObject
- Defined in:
- lib/redis/pipeline.rb
Constant Summary collapse
- FutureNotReady =
::Redis::FutureNotReady.new
Instance Method Summary collapse
- #_command ⇒ Object
- #_set(object) ⇒ Object
- #class ⇒ Object
-
#initialize(command, transformation) ⇒ Future
constructor
A new instance of Future.
- #inspect ⇒ Object
- #is_a?(other) ⇒ Boolean
- #value ⇒ Object
Constructor Details
#initialize(command, transformation) ⇒ Future
Returns a new instance of Future.
103 104 105 106 107 |
# File 'lib/redis/pipeline.rb', line 103 def initialize(command, transformation) @command = command @transformation = transformation @object = FutureNotReady end |
Instance Method Details
#_command ⇒ Object
118 119 120 |
# File 'lib/redis/pipeline.rb', line 118 def _command @command end |
#_set(object) ⇒ Object
113 114 115 116 |
# File 'lib/redis/pipeline.rb', line 113 def _set(object) @object = @transformation ? @transformation.call(object) : object value end |
#class ⇒ Object
131 132 133 |
# File 'lib/redis/pipeline.rb', line 131 def class Future end |
#inspect ⇒ Object
109 110 111 |
# File 'lib/redis/pipeline.rb', line 109 def inspect "<Redis::Future #{@command.inspect}>" end |
#is_a?(other) ⇒ Boolean
127 128 129 |
# File 'lib/redis/pipeline.rb', line 127 def is_a?(other) self.class.ancestors.include?(other) end |
#value ⇒ Object
122 123 124 125 |
# File 'lib/redis/pipeline.rb', line 122 def value ::Kernel.raise(@object) if @object.kind_of?(::RuntimeError) @object end |