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.
82 83 84 85 86 |
# File 'lib/redis/pipeline.rb', line 82 def initialize(command, transformation) @command = command @transformation = transformation @object = FutureNotReady end |
Instance Method Details
#_command ⇒ Object
97 98 99 |
# File 'lib/redis/pipeline.rb', line 97 def _command @command end |
#_set(object) ⇒ Object
92 93 94 95 |
# File 'lib/redis/pipeline.rb', line 92 def _set(object) @object = @transformation ? @transformation.call(object) : object value end |
#inspect ⇒ Object
88 89 90 |
# File 'lib/redis/pipeline.rb', line 88 def inspect "<Redis::Future #{@command.inspect}>" end |
#value ⇒ Object
101 102 103 104 |
# File 'lib/redis/pipeline.rb', line 101 def value ::Kernel.raise(@object) if @object.kind_of?(::Exception) @object end |