Class: HID::Persistence::Memory::Recorder

Inherits:
Object
  • Object
show all
Defined in:
lib/hid/persistence/memory/recorder.rb

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.storeObject

Returns the value of attribute store.



6
7
8
# File 'lib/hid/persistence/memory/recorder.rb', line 6

def store
  @store
end

Class Method Details

.record(input, type) ⇒ Object



8
9
10
11
12
13
# File 'lib/hid/persistence/memory/recorder.rb', line 8

def record(input, type)
  type_array = store[type] ||= []
  return if type_array.include? input
  type_array << input
  nil
end

.recorded(type) ⇒ Object



15
16
17
18
# File 'lib/hid/persistence/memory/recorder.rb', line 15

def recorded(type)
  return store unless type
  store[type] || []
end