-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support Ruby 2.7's pattern matching for
Layout/SpaceAroundKeyword
This PR supports guard `if` and `unless` syntax keywords of Ruby 2.7's pattern matching for `Layout/SpaceAroundKeyword`. ```ruby case 42 in 42 if true puts 'hello' end ``` These nodes are called `if-guard` and `unless-guard` when using guard `if` and `unless` in pattern matching. ```ruby % ruby-parse example.rb (case-match (int 42) (in-pattern (int 42) (if-guard (true)) (send nil :puts (str "hello"))) nil) ``` See below for this guard semantics: whitequark/parser#574 (comment)
- Loading branch information
Showing
3 changed files
with
18 additions
and
0 deletions.
There are no files selected for viewing
1 change: 1 addition & 0 deletions
1
..._support_guard_if_unless_of_pattern_matching_for_layout_space_around_keyword.md
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 @@ | ||
* [#9841](https://github.com/rubocop/rubocop/pull/9841): Support guard `if` and `unless` syntax keywords of Ruby 2.7's pattern matching for `Layout/SpaceAroundKeyword`. ([@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