Skip to content

Instantly share code, notes, and snippets.

@worace
Created February 4, 2016 21:50
Show Gist options
  • Save worace/bf0267fee2e0115ce1d8 to your computer and use it in GitHub Desktop.
Save worace/bf0267fee2e0115ce1d8 to your computer and use it in GitHub Desktop.
class FishTank
def initialize
# great place to do any initial
# setup or configuration
@fish = []
@water_volume = 0
@salinity = nil
end
def fill_tank(volume, water_type)
@water_volume = volume + @water_volume
@salinity = water_type
end
def salinity
@salinity
end
def add_fish(fish)
@fish << fish
end
def count_fish
@fish.count
end
end
tank = FishTank.new
puts "made a tank: #{tank}"
puts tank.count_fish
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment