Created
June 14, 2018 17:44
-
-
Save ethagnawl/27ba11bc74e535b1e31bbffc144189bf to your computer and use it in GitHub Desktop.
yield_self
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
modified_str = "foo" | |
.yield_self { |str| str.split('') } | |
.yield_self { |str| str.join('-') } | |
.yield_self(&:upcase) | |
.yield_self { |str| "#{str}!" } | |
puts modified_str # F-O-O! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment