summaryrefslogtreecommitdiff
path: root/golf_prelude.rb
diff options
context:
space:
mode:
authorknu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-12-28 04:46:56 (GMT)
committerknu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-12-28 04:46:56 (GMT)
commit7ad2d4cc9a4ef56aadc3823f938e7f77ced55765 (patch)
tree152d75f846ffb4d91f789f75fa5f0f38bbb6e978 /golf_prelude.rb
parent9343a2deb3c72047d0aee1449d185d066ca89b44 (diff)
* golf_prelude.rb (Object.const_missing): No need to delegate to
superclass. Just raise a NameError when none matches. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14754 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'golf_prelude.rb')
-rw-r--r--golf_prelude.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/golf_prelude.rb b/golf_prelude.rb
index 03c0c6c..69cbfb1 100644
--- a/golf_prelude.rb
+++ b/golf_prelude.rb
@@ -9,8 +9,8 @@ class Object
def self.const_missing c
r = /^#{c}/
- t = constants.sort.find{|e|r=~e}
- t ? const_get(t) : superclass.const_get(c)
+ t = constants.sort.find{|e|r=~e} and return const_get(t)
+ raise NameError, "uninitialized constant #{c}", caller(1)
end
def h(a='H', b='w', c='!')