Class: BattleBoats::Fleet

Inherits:
Object
  • Object
show all
Defined in:
lib/battle_boats/fleet.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeFleet

Returns a new instance of Fleet.


7
8
9
10
11
12
13
14
15
# File 'lib/battle_boats/fleet.rb', line 7

def initialize
  @ships = [
    BattleBoats::Ship.new(name: "Carrier", length: 5, symbol: "C"),
    BattleBoats::Ship.new(name: "Battleship", length: 4, symbol: "B"),
    BattleBoats::Ship.new(name: "Cruiser",    length: 3, symbol: "R"),
    BattleBoats::Ship.new(name: "Submarine",  length: 3, symbol: "S"),
    BattleBoats::Ship.new(name: "Destroyer",  length: 2, symbol: "D"),
  ]
end

Instance Attribute Details

#shipsObject (readonly)

Returns the value of attribute ships


5
6
7
# File 'lib/battle_boats/fleet.rb', line 5

def ships
  @ships
end