Class: MockRedis::Future
- Inherits:
-
Object
- Object
- MockRedis::Future
- Defined in:
- lib/mock_redis/future.rb
Instance Attribute Summary collapse
-
#command ⇒ Object
readonly
Returns the value of attribute command.
Instance Method Summary collapse
-
#initialize(command) ⇒ Future
constructor
A new instance of Future.
- #set_result(result) ⇒ Object
- #value ⇒ Object
Constructor Details
#initialize(command) ⇒ Future
Returns a new instance of Future.
7 8 9 10 |
# File 'lib/mock_redis/future.rb', line 7 def initialize(command) @command = command @result_set = false end |
Instance Attribute Details
#command ⇒ Object (readonly)
Returns the value of attribute command.
5 6 7 |
# File 'lib/mock_redis/future.rb', line 5 def command @command end |
Instance Method Details
#set_result(result) ⇒ Object
17 18 19 20 |
# File 'lib/mock_redis/future.rb', line 17 def set_result(result) @result_set = true @result = result end |
#value ⇒ Object
12 13 14 15 |
# File 'lib/mock_redis/future.rb', line 12 def value raise FutureNotReady unless @result_set @result end |