Class: Redis::Future

Inherits:
BasicObject
Defined in:
lib/redis/pipeline.rb

Direct Known Subclasses

MultiFuture

Constant Summary collapse

FutureNotReady =
::Redis::FutureNotReady.new

Instance Method Summary collapse

Constructor Details

#initialize(command, coerce, exception) ⇒ Future

Returns a new instance of Future.



83
84
85
86
87
88
# File 'lib/redis/pipeline.rb', line 83

def initialize(command, coerce, exception)
  @command = command
  @object = FutureNotReady
  @coerce = coerce
  @exception = exception
end

Instance Method Details

#_set(object) ⇒ Object



94
95
96
97
# File 'lib/redis/pipeline.rb', line 94

def _set(object)
  @object = @coerce ? @coerce.call(object) : object
  value
end

#classObject



108
109
110
# File 'lib/redis/pipeline.rb', line 108

def class
  Future
end

#inspectObject



90
91
92
# File 'lib/redis/pipeline.rb', line 90

def inspect
  "<Redis::Future #{@command.inspect}>"
end

#is_a?(other) ⇒ Boolean

Returns:

  • (Boolean)


104
105
106
# File 'lib/redis/pipeline.rb', line 104

def is_a?(other)
  self.class.ancestors.include?(other)
end

#valueObject



99
100
101
102
# File 'lib/redis/pipeline.rb', line 99

def value
  ::Kernel.raise(@object) if @exception && @object.is_a?(::StandardError)
  @object
end