Class: FluShot::Storage::Memory

Inherits:
Object
  • Object
show all
Defined in:
lib/flu_shot/storage/memory.rb

Instance Method Summary collapse

Constructor Details

#initializeMemory

Returns a new instance of Memory.



4
5
6
# File 'lib/flu_shot/storage/memory.rb', line 4

def initialize
  @storage = {}
end

Instance Method Details

#add(prescription_name, vaccines) ⇒ Object



8
9
10
11
12
# File 'lib/flu_shot/storage/memory.rb', line 8

def add(prescription_name, vaccines)
  @storage[prescription_name] ||= []
  vaccines = [vaccines] unless vaccines.is_a?(Array)
  @storage[prescription_name] = vaccines
end

#get(prescription_name) ⇒ Object



14
15
16
# File 'lib/flu_shot/storage/memory.rb', line 14

def get(prescription_name)
  @storage[prescription_name] || []
end