Class: GvIdMap

Inherits:
Object
  • Object
show all
Defined in:
lib/yaml2erd/gv_id_map.rb

Instance Method Summary collapse

Constructor Details

#initializeGvIdMap

Returns a new instance of GvIdMap.



2
3
4
5
# File 'lib/yaml2erd/gv_id_map.rb', line 2

def initialize
  @map = {}
  @cnt = 1
end

Instance Method Details

#enc(model) ⇒ Object



7
8
9
10
11
12
13
14
15
16
# File 'lib/yaml2erd/gv_id_map.rb', line 7

def enc(model)
  model = model.to_sym if model.class == String

  if @map[model].nil?
    @map[model] = @cnt.to_s.to_sym
    @cnt += 1
  end

  @map[model]
end