Skip to content

Instantly share code, notes, and snippets.

@qxjit
Created November 20, 2010 13:03
Show Gist options
  • Select an option

  • Save qxjit/707805 to your computer and use it in GitHub Desktop.

Select an option

Save qxjit/707805 to your computer and use it in GitHub Desktop.
Sending messages in ruby on new line without a trailing '.'
# This program prints out:
#
# Reversed: god
# God
#
# I originally found it in the documentation
# of BasicObject#tap in "Programming Ruby 1.9" by Dave Thomas
#
puts "dog"
.reverse
.tap {|o| puts "Reversed: #{o}"}
.capitalize
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment