Skip to content

Instantly share code, notes, and snippets.

@njonsson
Created May 1, 2010 03:02
Show Gist options
  • Save njonsson/386008 to your computer and use it in GitHub Desktop.
Save njonsson/386008 to your computer and use it in GitHub Desktop.
require 'tevye'
poor_tevye = Tevye.new
result = catch(:miracle_of_miracles) do
poor_tevye.live
end
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