Created
August 23, 2009 18:32
-
-
Save rosylilly/173377 to your computer and use it in GitHub Desktop.
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.class_eval do | |
undef :allocate | |
end | |
begin | |
p Class.new | |
rescue => e | |
p e | |
end | |
# => <Class:0x*******> | |
Class.class_eval do | |
undef :new | |
end | |
begin | |
p Class.new | |
rescue => e | |
p e | |
end | |
# => <NoMethodError: undefined method `new' for Class:Class> | |
begin | |
p Array.new | |
rescue => e | |
p e | |
end | |
# => <NoMethodError: undefined method `new' for Array:Class> | |
begin | |
p [] | |
rescue => e | |
p e | |
end | |
# => [] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment