Skip to content

Instantly share code, notes, and snippets.

@phoet
Created October 21, 2011 13:09
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 phoet/1303808 to your computer and use it in GitHub Desktop.
Save phoet/1303808 to your computer and use it in GitHub Desktop.
self inspection via exception
class Object;def fail!;raise "#{self}";end;end
"i want to be raised".fail!
# object.rb:1:in `fail!': i want to be raised (RuntimeError)
# from object.rb:3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment