Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support one-line pattern matching syntax
This PR supports one-line pattern matching syntax for `Layout/SpaceAroundKeyword` and `Layout/SpaceAroundOperators`. `match-pattern` node changes differently in Ruby 2.7 and Ruby 3.0. ## Ruby 2.7 (`Parser::Ruby27`) ```console % ruby-parse -e '42 in foo' (match-pattern (int 42) (match-var :foo)) ``` ## Ruby 3.0 (`Parser::Ruby30`) ```console % ruby-parse -e '42 => foo' (match-pattern (int 42) (match-var :foo)) ``` And one-line `in` syntax that represents one-line pattern maching changes from `match-pattern` node to `match-pattern-p` in Ruby 3.0. ```console % ruby-parse -e '42 in foo' (match-pattern-p (int 42) (match-var :foo)) ```
- Loading branch information
Showing
5 changed files
with
55 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
* [#9873](https://github.com/rubocop/rubocop/pull/9873): Support one-line pattern matching syntax for `Layout/SpaceAroundKeyword` and `Layout/SpaceAroundOperators`. ([@koic][]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters