Class: Kennel::IdMap

Inherits:
Object
  • Object
show all
Defined in:
lib/kennel/id_map.rb

Constant Summary collapse

NEW =

will be created during this run

:new

Instance Method Summary collapse

Constructor Details

#initializeIdMap

Returns a new instance of IdMap.



6
7
8
# File 'lib/kennel/id_map.rb', line 6

def initialize
  @map = Hash.new { |h, k| h[k] = {} }
end

Instance Method Details

#get(type, tracking_id) ⇒ Object



10
11
12
# File 'lib/kennel/id_map.rb', line 10

def get(type, tracking_id)
  @map[type][tracking_id]
end

#new?(type, tracking_id) ⇒ Boolean

Returns:

  • (Boolean)


18
19
20
# File 'lib/kennel/id_map.rb', line 18

def new?(type, tracking_id)
  @map[type][tracking_id] == NEW
end

#set(type, tracking_id, id) ⇒ Object



14
15
16
# File 'lib/kennel/id_map.rb', line 14

def set(type, tracking_id, id)
  @map[type][tracking_id] = id
end