Created
March 4, 2013 21:57
-
-
Save noriaki/5086053 to your computer and use it in GitHub Desktop.
tapを使ってメソッドチェインの途中の値をログ出力する ref: http://qiita.com/items/c94f57047560deea09ba
This file contains 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
TEST |
This file contains 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
"Test".upcase.reverse.next.swapcase | |
# => "tseu" |
This file contains 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
"Test".upcase.tap{|s| p s }.reverse.tap{|s| p s }.next.tap{|s| p s }.swapcase | |
"TEST" | |
"TSET" | |
"TSEU" | |
# => "tseu" |
This file contains 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
"Test".upcase.tap{|s| Rails.logger.debug s }.reverse.next.swapcase | |
# => "tseu" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment