Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Ruby 2.7's pattern matching for Layout/SpaceAroundKeyword #9841

Commits on May 31, 2021

  1. 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)
    koic committed May 31, 2021
    Copy the full SHA
    fbac420 View commit details
    Browse the repository at this point in the history