Skip to content

Instantly share code, notes, and snippets.

@etagwerker
Last active July 5, 2016 18:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save etagwerker/b0431bc17ea836edda2d6dd958a6f4f7 to your computer and use it in GitHub Desktop.
Save etagwerker/b0431bc17ea836edda2d6dd958a6f4f7 to your computer and use it in GitHub Desktop.
talk.rb
class Animal
attr_accessible :kind
def talk
fail "I don't know how to talk! "
end
end
class Cat < Animal
def talk
puts "Miau"
end
end
class Dog < Animal
def talk
puts "Guau"
end
end
class Bird < Animal
def talk
puts "Pio"
end
end
[Bird.new, Dog.new, Cat.new].map &:talk
"Pio"
"Guau"
"Miau"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment