From 603112ee5d33408a4cdbfe6ff7dfb99b60bd0c81 Mon Sep 17 00:00:00 2001 From: Xavier Noria Date: Thu, 21 Jan 2010 23:48:38 +0100 Subject: rewords rdoc about :allow_nil in Module#delegate --- activesupport/lib/active_support/core_ext/module/delegation.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'activesupport/lib') diff --git a/activesupport/lib/active_support/core_ext/module/delegation.rb b/activesupport/lib/active_support/core_ext/module/delegation.rb index c3f66d8ac1..4be7b9a97c 100644 --- a/activesupport/lib/active_support/core_ext/module/delegation.rb +++ b/activesupport/lib/active_support/core_ext/module/delegation.rb @@ -72,9 +72,9 @@ class Module # invoice.customer_name # => "John Doe" # invoice.customer_address # => "Vimmersvej 13" # - # If the object to which you delegate can be nil, you may want to use the - # :allow_nil option. In that case, it returns nil instead of raising a - # NoMethodError exception: + # If the delegate object is +nil+ an exception is raised, and that happens + # no matter whether +nil+ responds to the delegated method). You can get a + # +nil+ instead with the +:allow_nil+ option. # # class Foo # attr_accessor :bar @@ -124,7 +124,7 @@ class Module #{to}.__send__(#{method.inspect}, *args, &block) # client.__send__(:name, *args, &block) rescue NoMethodError # rescue NoMethodError if #{to}.nil? # if client.nil? - #{on_nil} + #{on_nil} # return # depends on :allow_nil else # else raise # raise end # end -- cgit v1.2.3