Class: Peek::Adapters::Memory

Inherits:
Base
  • Object
show all
Defined in:
lib/peek/adapters/memory.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Memory

Returns a new instance of Memory.



8
9
10
# File 'lib/peek/adapters/memory.rb', line 8

def initialize(options = {})
  @requests = {}
end

Instance Attribute Details

#requestsObject

Returns the value of attribute requests.



6
7
8
# File 'lib/peek/adapters/memory.rb', line 6

def requests
  @requests
end

Instance Method Details

#get(request_id) ⇒ Object



12
13
14
# File 'lib/peek/adapters/memory.rb', line 12

def get(request_id)
  @requests[request_id]
end

#resetObject



22
23
24
# File 'lib/peek/adapters/memory.rb', line 22

def reset
  @requests.clear
end

#save(request_id) ⇒ Object



16
17
18
19
20
# File 'lib/peek/adapters/memory.rb', line 16

def save(request_id)
  return false if request_id.blank?

  @requests[request_id] = Peek.results
end