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) ⇒ Future
constructor
A new instance of Future.
- #inspect ⇒ Object
- #is_a?(other) ⇒ Boolean
- #value ⇒ Object
Constructor Details
#initialize(command, coerce) ⇒ Future
Returns a new instance of Future.
82 83 84 85 86 |
# File 'lib/redis/pipeline.rb', line 82 def initialize(command, coerce) @command = command @object = FutureNotReady @coerce = coerce end |
Instance Method Details
#_set(object) ⇒ Object
92 93 94 95 |
# File 'lib/redis/pipeline.rb', line 92 def _set(object) @object = @coerce ? @coerce.call(object) : object value end |
#class ⇒ Object
106 107 108 |
# File 'lib/redis/pipeline.rb', line 106 def class Future end |
#inspect ⇒ Object
88 89 90 |
# File 'lib/redis/pipeline.rb', line 88 def inspect "<Redis::Future #{@command.inspect}>" end |
#is_a?(other) ⇒ Boolean
102 103 104 |
# File 'lib/redis/pipeline.rb', line 102 def is_a?(other) self.class.ancestors.include?(other) end |
#value ⇒ Object
97 98 99 100 |
# File 'lib/redis/pipeline.rb', line 97 def value ::Kernel.raise(@object) if @object.is_a?(::StandardError) @object end |