fastruby / fastruby/fast-ruby

Method call in a block could compare to `&:method_name` too

未关闭
#201 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
Suggestion
主要语言
Ruby
星标
5.7k
派生
371
PR 合并指标
30 天内没有已合并 PR

描述

This test https://github.com/fastruby/fast-ruby/blob/master/code/general/block-apply-method.rb is comparing:

```rb
def fast
[1, 2, 3].map { |n| do_something(n) }
end

def slow
[1, 2, 3].map(&method(:do_something))
end
```

We could have one more test:

```
def other
[1, 2, 3].map(&:do_something)
end
```

Also, I think the names `fast` and `slow` shouldn't be used for the methods, the names should describe what the method does, not which one is faster?

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。