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

Handle to_h with block in Style/HashTransformKeys and Style/HashTransformValues #8517

Merged
merged 1 commit into from Aug 11, 2020

Commits on Aug 11, 2020

  1. Handle to_h with block in hash transformation cops

    Since Ruby 2.6, `Hash#to_h` accepts a block which is called with each
    pair and must return a key and value to include in the new hash.
    
    If either the key or the value are always returned unchanged, using
    `Hash#transform_keys` or `Hash#transform_values` is faster and clearer.
    
    This is similar to the existing logic that detects `map { ... }.to_h`.
    eugeneius committed Aug 11, 2020
    Copy the full SHA
    6f754c5 View commit details
    Browse the repository at this point in the history