fastruby / fastruby/fast-ruby

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

Aperta
#201 1 commento 0 reazioni 0 assegnatari Vedi su GitHub
Suggestion
Lingua principale
Ruby
Stelle
5.7k
Fork
371
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

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?

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.