Class: RedisCluster::Future
- Inherits:
-
Object
- Object
- RedisCluster::Future
- Defined in:
- lib/redis_cluster/future.rb
Overview
Future basically act the same way as Redis::Future with some modification
Instance Attribute Summary collapse
-
#asking ⇒ Object
Returns the value of attribute asking.
-
#command ⇒ Object
readonly
Returns the value of attribute command.
-
#slot ⇒ Object
readonly
Returns the value of attribute slot.
-
#url ⇒ Object
Returns the value of attribute url.
Instance Method Summary collapse
-
#initialize(slot, command, transformation) ⇒ Future
constructor
A new instance of Future.
- #value ⇒ Object
- #value=(value) ⇒ Object
Constructor Details
#initialize(slot, command, transformation) ⇒ Future
Returns a new instance of Future.
12 13 14 15 16 17 18 |
# File 'lib/redis_cluster/future.rb', line 12 def initialize(slot, command, transformation) @slot = slot @command = command @transformation = transformation @value = Redis::Future::FutureNotReady @asking = false end |
Instance Attribute Details
#asking ⇒ Object
Returns the value of attribute asking.
10 11 12 |
# File 'lib/redis_cluster/future.rb', line 10 def asking @asking end |
#command ⇒ Object (readonly)
Returns the value of attribute command.
9 10 11 |
# File 'lib/redis_cluster/future.rb', line 9 def command @command end |
#slot ⇒ Object (readonly)
Returns the value of attribute slot.
9 10 11 |
# File 'lib/redis_cluster/future.rb', line 9 def slot @slot end |
#url ⇒ Object
Returns the value of attribute url.
10 11 12 |
# File 'lib/redis_cluster/future.rb', line 10 def url @url end |
Instance Method Details
#value ⇒ Object
20 21 22 23 |
# File 'lib/redis_cluster/future.rb', line 20 def value raise @value if @value.is_a?(::RuntimeError) @value end |
#value=(value) ⇒ Object
25 26 27 |
# File 'lib/redis_cluster/future.rb', line 25 def value=(value) @value = @transformation.call(value) end |