Created
October 31, 2011 17:43
-
-
Save etdebruin/1328122 to your computer and use it in GitHub Desktop.
Interfacing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Interface | |
def method_missing(method, *args, &block) | |
case method.to_s | |
when 'beaver' | |
throw 'Method missing' | |
end | |
end | |
def acorn | |
puts "acorn!" | |
end | |
end | |
class Command < Interface | |
def beaver | |
puts "beaver!" | |
end | |
end | |
a = Command.new | |
a.acorn | |
a.beaver |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment