fastruby / fastruby/fast-ruby

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

Open
#201 1 comment 0 reactions 0 assignees View on GitHub
Suggestion
Dominant language
Ruby
Stars
5.7k
Forks
371
PR merge metrics
No merged PRs in 30d

Description

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?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.