Class: MockRedis::Future

Inherits:
Object
  • Object
show all
Defined in:
lib/mock_redis/future.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#commandObject (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

#store_result(result) ⇒ Object



17
18
19
20
# File 'lib/mock_redis/future.rb', line 17

def store_result(result)
  @result_set = true
  @result = result
end

#valueObject

Raises:



12
13
14
15
# File 'lib/mock_redis/future.rb', line 12

def value
  raise FutureNotReady unless @result_set
  @result
end