Class: HID::Persistence::Memory::Identifier

Inherits:
Object
  • Object
show all
Defined in:
lib/hid/persistence/memory/identifier.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/identifier.rb', line 6

def store
  @store
end

Class Method Details

.find(input, type) ⇒ Object



8
9
10
# File 'lib/hid/persistence/memory/identifier.rb', line 8

def find(input, type)
  (type_hash = store[type]) && type_hash[input]
end

.map(input, identity, type) ⇒ Object



12
13
14
15
16
# File 'lib/hid/persistence/memory/identifier.rb', line 12

def map(input, identity, type)
  type_hash = store[type] ||= Hash.new
  type_hash[input] = identity
  nil
end