Module: Battle

Defined in:
lib/battle.rb,
lib/battle/game.rb,
lib/battle/version.rb

Defined Under Namespace

Classes: Game, GameAlreadyFinishedError, GameNotStartedYetError, PlayerEmailNotSpecified, PlayerNameNotSpecified, Ship

Constant Summary collapse

API_HOST =
"http://battle.platform45.com"
REGISTER_URL =
"#{ API_HOST }/register"
NUKE_URL =
"#{ API_HOST }/nuke"
AVAILABLE_SHIPS =
[
  { name: 'Carrier', amount: 1 },
  { name: 'Battleship', amount: 1 },
  { name: 'Destroyer', amount: 1 },
  { name: 'Submarine', amount: 2 },
  { name: 'Patrol Boat', amount: 2 }
]
VERSION =
"0.0.3"

Class Method Summary collapse

Class Method Details

.shipsObject



26
27
28
29
30
31
32
33
# File 'lib/battle.rb', line 26

def self.ships
  ships = []
  AVAILABLE_SHIPS.each do |ship|
    ship[:amount].times { ships << ship[:name] }
  end

  ships
end