Skip to content

Instantly share code, notes, and snippets.

@troyleach
Created January 21, 2015 22:18
Show Gist options
  • Select an option

  • Save troyleach/d5b118f0c5e48a754041 to your computer and use it in GitHub Desktop.

Select an option

Save troyleach/d5b118f0c5e48a754041 to your computer and use it in GitHub Desktop.
screen cast 13 and 14
class Person
def musical_instruments
instrument = Drums.new
puts "I own a #{instrument.size} #{instrument.set_name} set of drums"
end
def own_a_dog
milo = Dog.new
"My dogs name is #{milo.name}"
end
end
class Dog
def initialize
@eating = Food.new
end
def name
"Milo"
end
def eat
puts "When my dad isn't looking I will eat his #{@eating.pepperoni_pizza}"
end
end
class Food
def pepperoni_pizza
"Large pepperoni pizza"
end
def steak
"Porter House"
end
end
class Bird
def fly
puts "I can fly"
end
def music
puts "I can make music in the morning"
end
end
class Drums
def size
"10 piece"
end
def set_name
"ludwig"
end
end
troy = Person.new
puppy = Dog.new
pizza = Food.new
robin = Bird.new
ludwig = Drums.new
puts troy.own_a_dog
puts troy.musical_instruments
puts puppy.eat
@markeban

Copy link
Copy Markdown

I guess a dog will eat about anything - including pepperoni pizza 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment