Skip to content

Commit

Permalink
Merge pull request #1195 from ksss/re-eq-tilde
Browse files Browse the repository at this point in the history
Support Symbol and _ToStr for Regexp#=~
  • Loading branch information
soutaro authored Feb 13, 2023
2 parents 02fd3f7 + b22989a commit 4f9086d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion core/regexp.rbs
Original file line number Diff line number Diff line change
Expand Up @@ -948,7 +948,7 @@ class Regexp
# " x = y " =~ /(?<lhs>\w+)\s*=\s*(?<rhs>\w+)/
# p lhs, rhs # undefined local variable
#
def =~: (String? str) -> Integer?
def =~: (String? | Symbol | _ToStr str) -> Integer?

# <!--
# rdoc-file=re.c
Expand Down
1 change: 1 addition & 0 deletions test/stdlib/Regexp_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ def test_triple_equal
def test_equal_tilde
/at/ =~ "input data" #=> 7
/ax/ =~ "input data" #=> nil
/a/ =~ :a #=> 0
end

def test_casefold?
Expand Down

0 comments on commit 4f9086d

Please sign in to comment.