Class: Redis::Future
- Inherits:
- BasicObject
- Defined in:
- lib/redis/pipeline.rb
Direct Known Subclasses
Constant Summary collapse
- FutureNotReady =
::Redis::FutureNotReady.new.freeze
Instance Method Summary collapse
- #_set(object) ⇒ Object
- #_set_unless_error(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.
88 89 90 91 92 93 |
# File 'lib/redis/pipeline.rb', line 88 def initialize(command, coerce, exception) @command = command @object = FutureNotReady @coerce = coerce @exception = exception end |
Instance Method Details
#_set(object) ⇒ Object
99 100 101 102 |
# File 'lib/redis/pipeline.rb', line 99 def _set(object) @object = @coerce && !object.is_a?(::StandardError) ? @coerce.call(object) : object value end |
#_set_unless_error(object) ⇒ Object
104 105 106 |
# File 'lib/redis/pipeline.rb', line 104 def _set_unless_error(object) _set(object) unless @object.is_a?(::StandardError) end |
#class ⇒ Object
117 118 119 |
# File 'lib/redis/pipeline.rb', line 117 def class Future end |
#inspect ⇒ Object
95 96 97 |
# File 'lib/redis/pipeline.rb', line 95 def inspect "<Redis::Future #{@command.inspect}>" end |
#is_a?(other) ⇒ Boolean
113 114 115 |
# File 'lib/redis/pipeline.rb', line 113 def is_a?(other) self.class.ancestors.include?(other) end |
#value ⇒ Object
108 109 110 111 |
# File 'lib/redis/pipeline.rb', line 108 def value ::Kernel.raise(@object) if @exception && @object.is_a?(::StandardError) @object end |