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
-
#initialize(command, transformation) ⇒ Future
constructor
A new instance of Future.
- #inspect ⇒ Object
- #value ⇒ Object
Constructor Details
#initialize(command, transformation) ⇒ Future
Returns a new instance of Future.
101 102 103 104 105 |
# File 'lib/redis/pipeline.rb', line 101 def initialize(command, transformation) @command = command @transformation = transformation @object = FutureNotReady end |
Instance Method Details
#_command ⇒ Object
116 117 118 |
# File 'lib/redis/pipeline.rb', line 116 def _command @command end |
#_set(object) ⇒ Object
111 112 113 114 |
# File 'lib/redis/pipeline.rb', line 111 def _set(object) @object = @transformation ? @transformation.call(object) : object value end |
#inspect ⇒ Object
107 108 109 |
# File 'lib/redis/pipeline.rb', line 107 def inspect "<Redis::Future #{@command.inspect}>" end |
#value ⇒ Object
120 121 122 123 |
# File 'lib/redis/pipeline.rb', line 120 def value ::Kernel.raise(@object) if @object.kind_of?(::RuntimeError) @object end |