Class: Card::Codename

Inherits:
Object show all
Defined in:
lib/card/codename.rb

Constant Summary collapse

@@codehash =
nil

Class Method Summary collapse

Class Method Details

.[](key) ⇒ Object

returns codename for id and vice versa. not in love with this api –efm



12
13
14
15
16
17
# File 'lib/card/codename.rb', line 12

def [] key
  if !key.nil?
    key = key.to_sym unless Integer===key
    codehash[key]
  end
end

.bootdata(hash) ⇒ Object

only used in migration



29
30
31
# File 'lib/card/codename.rb', line 29

def bootdata hash
  @@codehash = hash
end

.codehashObject



19
20
21
# File 'lib/card/codename.rb', line 19

def codehash
  @@codehash || load_hash
end

.reset_cacheObject



23
24
25
26
# File 'lib/card/codename.rb', line 23

def reset_cache
  @@codehash = nil
  cache.write 'CODEHASH', nil
end