We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
h = { a: 1, b: 2 } h.map { |k, v| [k, v.to_s] }.to_h
上記のコードは transform_values で置き換えることができます。
h = { a: 1, b: 2 } h.transform_values(&:to_s)
map メソッドでブロック引数が2つあれば、おそらく Hash のインスタンスだとは思うけど、 確定できないので false positive が発生しそうです。
古い Ruby/Rails では使用できないメソッドなので、 Cop を作るときに注意が必要そう。
The text was updated successfully, but these errors were encountered:
rubocop/rubocop#7663 で実現されているためクローズします。
Sorry, something went wrong.
No branches or pull requests
上記のコードは transform_values で置き換えることができます。
注意する点
map は Enumerable のメソッド
map メソッドでブロック引数が2つあれば、おそらく Hash のインスタンスだとは思うけど、
確定できないので false positive が発生しそうです。
使える環境
古い Ruby/Rails では使用できないメソッドなので、 Cop を作るときに注意が必要そう。
The text was updated successfully, but these errors were encountered: