Skip to content

Instantly share code, notes, and snippets.

@sarony
Last active December 24, 2015 08:29
Show Gist options
  • Select an option

  • Save sarony/6770734 to your computer and use it in GitHub Desktop.

Select an option

Save sarony/6770734 to your computer and use it in GitHub Desktop.
def reverse_each_word(sentence)
# do your magic here
words=sentence.split(" ")
reversed=words.collect { |word| word.reverse }
reversed.join(" ")
end
reverse_each_word("This is cool and stuff.")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment