Skip to content

Instantly share code, notes, and snippets.

@milothiesen
Created July 18, 2016 11:59
Show Gist options
  • Save milothiesen/0964e4d5a0ebb2b69cb8ade830ce2d92 to your computer and use it in GitHub Desktop.
Save milothiesen/0964e4d5a0ebb2b69cb8ade830ce2d92 to your computer and use it in GitHub Desktop.
class Dog
attr_accessor :bark, :run
def initialize(bark, run)
@bark = bark
@run = run
end
end
class Pony
attr_accessor :gallop, :trot
def initialize(gallop, trot)
@gallop = gallop
@trot = trot
end
end
class Mountain
attr_accessor :peak, :timberline
def initialize(peak, timberline)
@peak = peak
@timberline = timberline
end
end
dog = Dog.new("arf!!", "so fast!")
puts dog
puts dog.bark
puts dog.run
pony = Pony.new("faster!!", "starting out slow!")
puts pony
puts pony.gallop
puts pony.trot
mountain = Mountain.new("we're at the top.", "the trees stop here.")
puts mountain
puts mountain.peak
puts mountain.timberline
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment