Class: Redis::Future
- Inherits:
- BasicObject
- Defined in:
- lib/redis/pipeline.rb
Direct Known Subclasses
Constant Summary collapse
- FutureNotReady =
::Redis::FutureNotReady.new
Instance Method Summary collapse
- #_set(object) ⇒ Object
- #class ⇒ Object
-
#initialize(command, coerce, exception) ⇒ Future
constructor
A new instance of Future.
- #inspect ⇒ Object
- #is_a?(other) ⇒ Boolean
- #value ⇒ Object
Constructor Details
#initialize(command, coerce, exception) ⇒ Future
Returns a new instance of Future.
83 84 85 86 87 88 |
# File 'lib/redis/pipeline.rb', line 83 def initialize(command, coerce, exception) @command = command @object = FutureNotReady @coerce = coerce @exception = exception end |
Instance Method Details
#_set(object) ⇒ Object
94 95 96 97 |
# File 'lib/redis/pipeline.rb', line 94 def _set(object) @object = @coerce ? @coerce.call(object) : object value end |
#class ⇒ Object
108 109 110 |
# File 'lib/redis/pipeline.rb', line 108 def class Future end |
#inspect ⇒ Object
90 91 92 |
# File 'lib/redis/pipeline.rb', line 90 def inspect "<Redis::Future #{@command.inspect}>" end |
#is_a?(other) ⇒ Boolean
104 105 106 |
# File 'lib/redis/pipeline.rb', line 104 def is_a?(other) self.class.ancestors.include?(other) end |
#value ⇒ Object
99 100 101 102 |
# File 'lib/redis/pipeline.rb', line 99 def value ::Kernel.raise(@object) if @exception && @object.is_a?(::StandardError) @object end |