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
11 12 13 14 15 |
# File 'lib/card/codename.rb', line 11 def [] key return if key.nil? key = key.to_sym unless key.is_a? Integer codehash[key] end |
.bootdata(hash) ⇒ Object
only used in migration
27 28 29 |
# File 'lib/card/codename.rb', line 27 def bootdata hash @@codehash = hash end |
.codehash ⇒ Object
17 18 19 |
# File 'lib/card/codename.rb', line 17 def codehash @@codehash || load_hash end |
.reset_cache ⇒ Object
21 22 23 24 |
# File 'lib/card/codename.rb', line 21 def reset_cache @@codehash = nil cache.write 'CODEHASH', nil end |