Polite

Be nice to Ruby and it will be nice to you.

Installation

The best way to introduce politeness into Ruby is to use RubyGems:

$ [sudo] gem install polite

Please

If you’re rude to Ruby it will be rude to you:

ruby = Object.new
ruby.get_me_a_coffee
# => NoMethodError: undefined method `get_me_a_coffee' for #<Object:0x007fb0421526c0>

But if you’re polite, it will be nice to you.

ruby.please.get_me_a_coffee
# => nil

However, even Ruby has it’s limits:

ruby.please.get_me_a_coffee.and_a_sandwich
# => NoMethodError: undefined method `and_a_sandwich' for nil:NilClass

Pretty please

If you want Ruby to do a lot for you, the way to go is to be even more polite:

ruby.pretty_please.get_me_a_coffee
# => #<Object:0x007fb0421526c0>

Ruby will definitely be nice to you:

ruby.pretty_please.get_me_a_coffee.and_a_sandwich.and_a_newspaper
# => #<Object:0x007fb0421526c0>

ruby.pretty_please.respond_to?(:pay_for_my_dinner)
# => true

License

Copyright (c) 2011 Tobias Svensson.

Pick a polite license of your choice.