* 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
This commit is contained in:
eban 2007-12-30 14:20:37 +00:00
parent ce1834d658
commit 75ee1d5252
2 changed files with 6 additions and 2 deletions

View File

@ -1,3 +1,7 @@
Sun Dec 30 23:19:06 2007 WATANABE Hirofumi <eban@ruby-lang.org>
* golf_prelude.rb (@@golf_hash): for performance improvement.
Sun Dec 30 22:44:50 2007 Tadayoshi Funaba <tadf@dotrb.org>
* lib/date.rb (_valid_time?): I'm not sure to recommend such an

View File

@ -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