Skip to content

Instantly share code, notes, and snippets.

@steveklabnik
Created August 13, 2011 03:12
Show Gist options
  • Select an option

  • Save steveklabnik/1143436 to your computer and use it in GitHub Desktop.

Select an option

Save steveklabnik/1143436 to your computer and use it in GitHub Desktop.
Duck typing!
class Something
def hey
"hello"
end
end
class OtherThing
def hey
"hi"
end
end
def do_it(thing)
puts thing.hey
end
s = Something.new
o = OtherThing.new
do_it(s)
do_it(o)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment