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) ⇒ Future

Returns a new instance of Future.



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

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

Instance Method Details

#_set(object) ⇒ Object



92
93
94
95
# File 'lib/redis/pipeline.rb', line 92

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

#classObject



106
107
108
# File 'lib/redis/pipeline.rb', line 106

def class
  Future
end

#inspectObject



88
89
90
# File 'lib/redis/pipeline.rb', line 88

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

#is_a?(other) ⇒ Boolean

Returns:

  • (Boolean)


102
103
104
# File 'lib/redis/pipeline.rb', line 102

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

#valueObject



97
98
99
100
# File 'lib/redis/pipeline.rb', line 97

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