Created
June 10, 2013 22:14
-
-
Save chhhris/5752888 to your computer and use it in GitHub Desktop.
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
# Chain at least 5 method calls to an object. Reduce this operation one chain at a time. | |
puts "rotator dad rotator".reverse.slice(8,3).capitalize.slice(0,0).concat("Father's Day is this weekend.") | |
# Don't just use the methods below, make up your own chain and try to see if you can do something fun with Ruby like in the example. | |
puts "rotator dad rotator".reverse | |
# #=> rotator dad rotator | |
puts "rotator dad rotator".reverse.slice(8,3) | |
# #=> dad | |
puts "rotator dad rotator".reverse.slice(8,3).capitalize | |
# #=> Dad | |
puts "rotator dad rotator".reverse.slice(8,3).capitalize.slice(0,0) | |
# #=> | |
puts "rotator dad rotator".reverse.slice(8,3).capitalize.slice(0,0).concat("Father's Day is this weekend.") | |
# #=> Father's Day is this weekend. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment