Class: Card::Codename
Constant Summary collapse
- @@codehash =
nil
Class Method Summary collapse
-
.[](key) ⇒ Object
returns codename for id and vice versa.
-
.bootdata(hash) ⇒ Object
only used in migration.
- .codehash ⇒ Object
- .reset_cache ⇒ Object
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 |
.codehash ⇒ Object
19 20 21 |
# File 'lib/card/codename.rb', line 19 def codehash @@codehash || load_hash end |
.reset_cache ⇒ Object
23 24 25 26 |
# File 'lib/card/codename.rb', line 23 def reset_cache @@codehash = nil cache.write 'CODEHASH', nil end |