Class: Redis::Future
- Inherits:
- BasicObject
- Defined in:
- lib/redis/pipeline.rb
Constant Summary collapse
- FutureNotReady =
::Redis::FutureNotReady.new
Instance Attribute Summary collapse
-
#timeout ⇒ Object
readonly
Returns the value of attribute timeout.
Instance Method Summary collapse
- #==(_other) ⇒ Object
- #_command ⇒ Object
- #_set(object) ⇒ Object
- #class ⇒ Object
-
#initialize(command, transformation, timeout) ⇒ Future
constructor
A new instance of Future.
- #inspect ⇒ Object
- #is_a?(other) ⇒ Boolean
- #value ⇒ Object
Constructor Details
#initialize(command, transformation, timeout) ⇒ Future
Returns a new instance of Future.
231 232 233 234 235 236 |
# File 'lib/redis/pipeline.rb', line 231 def initialize(command, transformation, timeout) @command = command @transformation = transformation @timeout = timeout @object = FutureNotReady end |
Instance Attribute Details
#timeout ⇒ Object (readonly)
Returns the value of attribute timeout.
229 230 231 |
# File 'lib/redis/pipeline.rb', line 229 def timeout @timeout end |
Instance Method Details
#==(_other) ⇒ Object
238 239 240 241 242 243 244 245 246 |
# File 'lib/redis/pipeline.rb', line 238 def ==(_other) = +"The methods == and != are deprecated for Redis::Future and will be removed in 5.0.0" << " - You probably meant to call .value == or .value !=" << " (#{::Kernel.caller(1, 1).first})\n" ::Redis.deprecate!() super end |
#_command ⇒ Object
257 258 259 |
# File 'lib/redis/pipeline.rb', line 257 def _command @command end |
#_set(object) ⇒ Object
252 253 254 255 |
# File 'lib/redis/pipeline.rb', line 252 def _set(object) @object = @transformation ? @transformation.call(object) : object value end |
#class ⇒ Object
270 271 272 |
# File 'lib/redis/pipeline.rb', line 270 def class Future end |
#inspect ⇒ Object
248 249 250 |
# File 'lib/redis/pipeline.rb', line 248 def inspect "<Redis::Future #{@command.inspect}>" end |
#is_a?(other) ⇒ Boolean
266 267 268 |
# File 'lib/redis/pipeline.rb', line 266 def is_a?(other) self.class.ancestors.include?(other) end |
#value ⇒ Object
261 262 263 264 |
# File 'lib/redis/pipeline.rb', line 261 def value ::Kernel.raise(@object) if @object.is_a?(::RuntimeError) @object end |