Class: Redis::Future

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

Constant Summary

FutureNotReady =
::Redis::FutureNotReady.new

Instance Method Summary (collapse)

Constructor Details

- (Future) initialize(command, transformation)

Returns a new instance of Future



109
110
111
112
113
# File 'lib/redis/pipeline.rb', line 109

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

Instance Method Details

- (Object) _command



124
125
126
# File 'lib/redis/pipeline.rb', line 124

def _command
  @command
end

- (Object) _set(object)



119
120
121
122
# File 'lib/redis/pipeline.rb', line 119

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

- (Object) class



137
138
139
# File 'lib/redis/pipeline.rb', line 137

def class
  Future
end

- (Object) inspect



115
116
117
# File 'lib/redis/pipeline.rb', line 115

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

- (Boolean) is_a?(other)

Returns:

  • (Boolean)


133
134
135
# File 'lib/redis/pipeline.rb', line 133

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

- (Object) value



128
129
130
131
# File 'lib/redis/pipeline.rb', line 128

def value
  ::Kernel.raise(@object) if @object.kind_of?(::RuntimeError)
  @object
end