Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

allow to grep a method object for Regexp#=~ and invoke that with only…

… one arg
  • Loading branch information...
commit 42f475beccaaa661e38bc1af992098ca28f542bf 1 parent 011081b
@timfel timfel authored
Showing with 4 additions and 2 deletions.
  1. +4 −2 src/kernel/bootstrap/Regexp.rb
View
6 src/kernel/bootstrap/Regexp.rb
@@ -232,7 +232,8 @@ def match(*args, &block)
# only one-arg call supported. any other invocation
# will have a bridge method interposed which would
# require different args to __storeRubyVcGlobal
- raise ArgumentError, 'expected 1 arg with no block'
+ raise(ArgumentError, 'expected 1 arg with no block') if block
+ return self.match(args[0])
end
def match(str)
@@ -257,7 +258,8 @@ def =~(*args, &block)
# only one-arg call supported. any other invocation
# will have a bridge method interposed which would
# require different args to __storeRubyVcGlobal
- raise ArgumentError, 'expected 1 arg with no block'
+ raise(ArgumentError, 'expected 1 arg with no block') if block
+ return self =~ args[0]
end
def =~(str)
Please sign in to comment.
Something went wrong with that request. Please try again.