fastruby / fastruby/fast-ruby

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

Đang mở
#201 1 bình luận 0 reaction 0 người được giao Xem trên GitHub
Suggestion
Ngôn ngữ chính
Ruby
Star
5.7k
Fork
371
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

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?

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.