Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我写了这段代码:
my.objects.map { |object| object.key }
我的 rubocop 说:
Pass &:key as an argument to map instead of a block.
有没有做同样事情的捷径?
将 &:key 作为参数传递给 map 而不是块
方法:
my.objects.map(&:key)