Skip to content

Commit

Permalink
Merge pull request #2866 from naitoh/fix_string_scanner_match
Browse files Browse the repository at this point in the history
fix StringScanner#<<
  • Loading branch information
znz authored May 6, 2024
2 parents 80f62cb + d1b5bb2 commit 47f728f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions refm/api/src/strscan.rd
Original file line number Diff line number Diff line change
Expand Up @@ -189,14 +189,14 @@ selfを返します。
require 'strscan'

s = StringScanner.new('test') # => #<StringScanner 0/4 @ "test">
s.match(/\w(\w*)/) # => "test"
s.scan(/\w(\w*)/) # => "test"
s[0] # => "test"
s[1] # => "est"
s << ' string' # => #<StringScanner 4/11 "test" @ " stri...">
s[0] # => "test"
s[1] # => "est"
s.match(/\s+/) # => " "
s.match(/\w+/) # => "string"
s.scan(/\s+/) # => " "
s.scan(/\w+/) # => "string"
#@end

この操作は StringScanner.new に渡した文字列にも影響することがあります。
Expand Down

0 comments on commit 47f728f

Please sign in to comment.