Class: Redi::Mock

Inherits:
Object
  • Object
show all
Defined in:
lib/redi/mock.rb

Instance Method Summary collapse

Constructor Details

#initializeMock

Returns a new instance of Mock.



22
23
24
# File 'lib/redi/mock.rb', line 22

def initialize
  @store = {}
end

Instance Method Details

#del(key) ⇒ Object



30
31
32
# File 'lib/redi/mock.rb', line 30

def del(key)
  @store.delete(key)
end

#flushallObject



42
43
44
# File 'lib/redi/mock.rb', line 42

def flushall
  @store = {}
end

#get(key) ⇒ Object



26
27
28
# File 'lib/redi/mock.rb', line 26

def get(key)
  @store[key]
end

#mget(*keys) ⇒ Object



38
39
40
# File 'lib/redi/mock.rb', line 38

def mget(*keys)
  keys.map {|k| get(k) }
end

#set(key, val) ⇒ Object



34
35
36
# File 'lib/redi/mock.rb', line 34

def set(key, val)
  @store[key] = val
end