Hacker News
new
|
past
|
comments
|
ask
|
show
|
jobs
|
submit
login
luigi
on Aug 30, 2009
|
parent
|
context
|
favorite
| on:
Rewriting Returning in Rails
Any insight as to why they chose to name it tap instead of returning? I much prefer returning.
raganwald
on Aug 30, 2009
[–]
The original use cae was where you have a method chain and you want to "tap into" one of the values, e.g.
foo().bar().blitz()
becomes:
foo().bar().tap { |b| puts b.inspect }.blitz()
It takes its inspiration from Unix's "tee."
Guidelines
|
FAQ
|
Lists
|
API
|
Security
|
Legal
|
Apply to YC
|
Contact
Search: