Class: Redis2::Future
- Inherits:
- BasicObject
- Defined in:
- lib/redis2/pipeline.rb
Constant Summary collapse
- FutureNotReady =
::Redis2::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.
109 110 111 112 113 |
# File 'lib/redis2/pipeline.rb', line 109 def initialize(command, transformation) @command = command @transformation = transformation @object = FutureNotReady end |
Instance Method Details
#_command ⇒ Object
124 125 126 |
# File 'lib/redis2/pipeline.rb', line 124 def _command @command end |
#_set(object) ⇒ Object
119 120 121 122 |
# File 'lib/redis2/pipeline.rb', line 119 def _set(object) @object = @transformation ? @transformation.call(object) : object value end |
#class ⇒ Object
137 138 139 |
# File 'lib/redis2/pipeline.rb', line 137 def class Future end |
#inspect ⇒ Object
115 116 117 |
# File 'lib/redis2/pipeline.rb', line 115 def inspect "<Redis2::Future #{@command.inspect}>" end |
#is_a?(other) ⇒ Boolean
133 134 135 |
# File 'lib/redis2/pipeline.rb', line 133 def is_a?(other) self.class.ancestors.include?(other) end |
#value ⇒ Object
128 129 130 131 |
# File 'lib/redis2/pipeline.rb', line 128 def value ::Kernel.raise(@object) if @object.kind_of?(::RuntimeError) @object end |