module BattleShip
Constants
- VERSION
Public Class Methods
include!()
click to toggle source
# File lib/battle_ship.rb, line 21 def self.include! Rails.cache.class.class_eval("prepend BattleShip") end
Public Instance Methods
hits(key)
click to toggle source
# File lib/battle_ship.rb, line 2 def hits(key) read(key.to_s.camelize << '_hits', skip_increment: true, raw: true) end
misses(key)
click to toggle source
# File lib/battle_ship.rb, line 6 def misses(key) read(key.to_s.camelize << '_misses', skip_increment: true, raw: true) end
Private Instance Methods
key_up_to_first_underscore(key)
click to toggle source
# File lib/battle_ship.rb, line 30 def key_up_to_first_underscore(key) key[0..(key.index('_') -1)] end
namespace(key, options)
click to toggle source
# File lib/battle_ship.rb, line 26 def namespace(key, options) (options[:namespace] || key_up_to_first_underscore(key)).camelize end