-
-
Save stevegraham/3753164 to your computer and use it in GitHub Desktop.
Object#tap
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
| def logger | |
| @logger ||= Logger.new(STDOUT) | |
| end |
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
| def logger | |
| @logger ||= Logger.new(STDOUT) | |
| @logger.datetime_format = '%c' | |
| @logger | |
| end |
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
| def logger | |
| @logger ||= Logger.new(STDOUT).tap { |o| o.datetime_format = '%c' } | |
| end |
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
| Object.class_eval { def tap() yield self; self end } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment