Created
June 7, 2014 21:06
-
-
Save anonymous/79a57517f53e275bb1b3 to your computer and use it in GitHub Desktop.
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
result = my_arrai.each_with_object({}) do |word, transformed| | |
transformed[word] = word.capitalize | |
end | |
puts result | |
##### OR ##### | |
def transform(my_arrai) | |
my_arrai.each_with_object({}) do |word, transformed| | |
transformed[word] = word.capitalize | |
end | |
end | |
my_arrai = %w[mama died today or was it yesterday] | |
puts transform(my_arrai) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment