diff options
author | Xavier Noria <fxn@hashref.com> | 2010-01-21 23:48:38 +0100 |
---|---|---|
committer | Xavier Noria <fxn@hashref.com> | 2010-01-21 23:48:38 +0100 |
commit | 603112ee5d33408a4cdbfe6ff7dfb99b60bd0c81 (patch) | |
tree | 04b275392c0e7d0488511c4b89d6c24ea6b71327 | |
parent | 6d70b93450993d44f88aa5d389d17cc231fcd999 (diff) | |
download | rails-603112ee5d33408a4cdbfe6ff7dfb99b60bd0c81.tar.gz rails-603112ee5d33408a4cdbfe6ff7dfb99b60bd0c81.tar.bz2 rails-603112ee5d33408a4cdbfe6ff7dfb99b60bd0c81.zip |
rewords rdoc about :allow_nil in Module#delegate
-rw-r--r-- | activesupport/lib/active_support/core_ext/module/delegation.rb | 8 |
1 files changed, 4 insertions, 4 deletions
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 |