I have this class:
class Game
attr_accessor :player_fleet, :opponent_fleet
@player_fleet = []
@opponent_fleet = []
...
end
and create an instance like this:
my_game = Game.new
then use it like this:
my_game.opponent_fleet << opponent
which gives me this error:
undefined method `<<' for nil:NilClass (NoMethodError)
Why can't I treat an array like this? Do I have to create a method to push objects into the array?