class NebulousStomp::RedisHandlerNull

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.

Attributes

fake_pair[R]

Public Class Methods

new(connectHash={}) click to toggle source
Calls superclass method NebulousStomp::RedisHandler::new
# File lib/nebulous_stomp/redis_handler_null.rb, line 19
def initialize(connectHash={})
  super
  @fake_pair = {}
end

Public Instance Methods

connect() click to toggle source
# File lib/nebulous_stomp/redis_handler_null.rb, line 28
def connect
  @redis = true
  self
end
connected?() click to toggle source
# File lib/nebulous_stomp/redis_handler_null.rb, line 38
def connected?
  @fake_pair != {}
end
del(key) click to toggle source
# 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) click to toggle source
# File lib/nebulous_stomp/redis_handler_null.rb, line 53
def get(key)
  @fake_pair.values.first
end
insert_fake(key, value) click to toggle source
# File lib/nebulous_stomp/redis_handler_null.rb, line 24
def insert_fake(key, value)
  @fake_pair = { key => value }
end
quit() click to toggle source
# File lib/nebulous_stomp/redis_handler_null.rb, line 33
def quit
  @redis = nil
  self
end
set(key, value, hash=nil) click to toggle source
# File lib/nebulous_stomp/redis_handler_null.rb, line 42
def set(key, value, hash=nil) 
  insert_fake(key, value)
  "OK"
end