Skip to content

Commit

Permalink
golf_prelude.rb: suppress the redefining warning
Browse files Browse the repository at this point in the history
  • Loading branch information
nobu committed Jun 22, 2019
1 parent bad66f3 commit f738eea
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions golf_prelude.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
class Object
@@golf_hash = {}

verbose, $VERBOSE = $VERBOSE, nil
def method_missing m, *a, &b
t = @@golf_hash[ [m, self.class] ] ||= matching_methods(m)[0]
if t && b
Expand All @@ -12,6 +13,7 @@ def method_missing m, *a, &b
t ? __send__(t, *a, &b) : super
end
end
$VERBOSE = verbose

def matching_methods(s = '', m = callable_methods)
r = /^#{s.to_s.gsub(/./){"(.*?)" + Regexp.escape($&)}}/
Expand Down

0 comments on commit f738eea

Please sign in to comment.