File tree Expand file tree Collapse file tree 2 files changed +12
-5
lines changed Expand file tree Collapse file tree 2 files changed +12
-5
lines changed Original file line number Diff line number Diff line change @@ -40,6 +40,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a
40
40
- Ensure the ` Return ` breaks with brackets and not parentheses.
41
41
- Ensure trailing comments on parameter declarations are consistent.
42
42
- Make ` Command ` and ` CommandCall ` aware that their arguments could exceed their normal expected bounds because of heredocs.
43
+ - Only unescape forward slashes in regular expressions if converting from slash bounds to ` %r ` bounds.
43
44
44
45
### Removed
45
46
Original file line number Diff line number Diff line change @@ -9755,12 +9755,18 @@ def format(q)
9755
9755
q . group do
9756
9756
q . text ( "%r{" )
9757
9757
9758
- parts . each do |part |
9759
- if part . is_a? ( TStringContent )
9760
- q . text ( part . value . gsub ( "\\ /" , "/" ) )
9761
- else
9762
- q . format ( part )
9758
+ if beginning == "/"
9759
+ # If we're changing from a forward slash to a %r{, then we can
9760
+ # replace any escaped forward slashes with regular forward slashes.
9761
+ parts . each do |part |
9762
+ if part . is_a? ( TStringContent )
9763
+ q . text ( part . value . gsub ( "\\ /" , "/" ) )
9764
+ else
9765
+ q . format ( part )
9766
+ end
9763
9767
end
9768
+ else
9769
+ q . format_each ( parts )
9764
9770
end
9765
9771
9766
9772
q . text ( "}" )
You can’t perform that action at this time.
0 commit comments