Skip to content

Instantly share code, notes, and snippets.

@loganhasson
Created September 30, 2013 20:27
Show Gist options
  • Save loganhasson/6769742 to your computer and use it in GitHub Desktop.
Save loganhasson/6769742 to your computer and use it in GitHub Desktop.
def rev_in_place(sentence)
backwards = sentence.split.map { |word| word.reverse }.join(' ')
end
@sammylupt
Copy link

Had no idea you could chain a method to a block like that, but I guess it works because you're calling it on backwards. Slick

@loganhasson
Copy link
Author

I had no idea either...just figured I'd give it a go.
thanks brah

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment