Skip to content

Commit

Permalink
* golf_prelude.rb (@@golf_hash): for performance improvement.
Browse files Browse the repository at this point in the history
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14801 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information
eban committed Dec 30, 2007
1 parent ce1834d commit 75ee1d5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 4 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
Sun Dec 30 23:19:06 2007 WATANABE Hirofumi <[email protected]>

* golf_prelude.rb (@@golf_hash): for performance improvement.

Sun Dec 30 22:44:50 2007 Tadayoshi Funaba <[email protected]>

* lib/date.rb (_valid_time?): I'm not sure to recommend such an
Expand Down
4 changes: 2 additions & 2 deletions golf_prelude.rb
Original file line number Diff line number Diff line change
@@ -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

Expand Down

0 comments on commit 75ee1d5

Please sign in to comment.