Class: NebulousStomp::RedisHandlerNull
Overview
Behaves just like RedisHandler, except, does nothing and expects no connection to Redis.
This is hopefully useful for testing – if only for testing of Nebulous.
Instance Attribute Summary collapse
Attributes inherited from RedisHandler
#redis
Instance Method Summary
collapse
#method_missing, #redis_on?
Constructor Details
Returns a new instance of RedisHandlerNull.
19
20
21
22
|
# File 'lib/nebulous_stomp/redis_handler_null.rb', line 19
def initialize(connectHash={})
super
@fake_pair = {}
end
|
Instance Attribute Details
#fake_pair ⇒ Object
Returns the value of attribute fake_pair.
17
18
19
|
# File 'lib/nebulous_stomp/redis_handler_null.rb', line 17
def fake_pair
@fake_pair
end
|
Instance Method Details
#connect ⇒ Object
28
29
30
31
|
# File 'lib/nebulous_stomp/redis_handler_null.rb', line 28
def connect
@redis = true
self
end
|
#connected? ⇒ Boolean
38
39
40
|
# File 'lib/nebulous_stomp/redis_handler_null.rb', line 38
def connected?
@fake_pair != {}
end
|
#del(key) ⇒ Object
47
48
49
50
51
|
# File 'lib/nebulous_stomp/redis_handler_null.rb', line 47
def del(key)
x = @fake_pair.empty? ? 0 : 1
@fake_pair = {}
x
end
|
#get(key) ⇒ Object
53
54
55
|
# File 'lib/nebulous_stomp/redis_handler_null.rb', line 53
def get(key)
@fake_pair.values.first
end
|
#insert_fake(key, value) ⇒ Object
24
25
26
|
# File 'lib/nebulous_stomp/redis_handler_null.rb', line 24
def insert_fake(key, value)
@fake_pair = { key => value }
end
|
#quit ⇒ Object
33
34
35
36
|
# File 'lib/nebulous_stomp/redis_handler_null.rb', line 33
def quit
@redis = nil
self
end
|
#set(key, value, hash = nil) ⇒ Object
42
43
44
45
|
# File 'lib/nebulous_stomp/redis_handler_null.rb', line 42
def set(key, value, hash=nil)
insert_fake(key, value)
"OK"
end
|