summaryrefslogtreecommitdiff
path: root/golf_prelude.rb
diff options
context:
space:
mode:
authoreban <eban@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-12-30 14:20:37 +0000
committereban <eban@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-12-30 14:20:37 +0000
commit75ee1d525277c0e07fce061af0ad73cda00250ae (patch)
tree598ef57050f38e55591f97252f8b37dad1c240f6 /golf_prelude.rb
parentce1834d6587bcf71dc534fd351e9ffcbc69f264b (diff)
downloadruby-75ee1d525277c0e07fce061af0ad73cda00250ae.tar.gz
* golf_prelude.rb (@@golf_hash): for performance improvement.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14801 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 eea08fef74..c0ae37fb17 100644
--- a/golf_prelude.rb
+++ b/golf_prelude.rb
@@ -1,9 +1,9 @@
SCRIPT_LINES__={}
class Object
+ @@golf_hash = {}
def method_missing m, *a, &b
- r = /^#{m}/
- t = (methods + private_methods).sort.find{|e|r=~e}
+ t = @@golf_hash[[m,self.class]] ||= (methods + private_methods).sort.find{|e|/^#{m}/=~e}
t ? __send__(t, *a, &b) : super
end