Created
June 11, 2012 22:51
-
-
Save pjb3/2913229 to your computer and use it in GitHub Desktop.
Tap that object
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # To tap | |
| def activate_person(person_id) | |
| Person.find(person_id).tap do |person| | |
| person.activate! | |
| end | |
| end | |
| # or not to tap | |
| def activate_person(person_id) | |
| person = Person.find(person_id) | |
| person.activate! | |
| person | |
| end | |
| # that is the question |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@glv @pjb3 A few months back @brixen saw me using
#tapand lamented on how it's not ideal because it creates a new scope when a perfectly suitable one already exists. From what I remember he said it's not worth extending the stack for no good reason. Why make the VM do more work when the context is already set up already? @brixen, did I get that right?