Created
May 1, 2010 03:02
-
-
Save njonsson/386008 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
require 'tevye' | |
poor_tevye = Tevye.new | |
result = catch(:miracle_of_miracles) do | |
poor_tevye.live | |
end |
This file contains hidden or 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 Tevye | |
def live | |
sunrise | |
sunset | |
l_chaim! | |
toil_in_anatevka | |
:pauper | |
end | |
def rich_man? | |
false | |
end | |
private | |
def method_missing(method, *args) | |
nil | |
end | |
def toil_in_anatevka | |
if self.rich_man? | |
throw :miracle_of_miracles, 'Emigrated to the Cayman Islands' | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment