Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

rewords rdoc about :allow_nil in Module#delegate

  • Loading branch information...
commit 603112ee5d33408a4cdbfe6ff7dfb99b60bd0c81 1 parent 6d70b93
@fxn fxn authored
Showing with 4 additions and 4 deletions.
  1. +4 −4 activesupport/lib/active_support/core_ext/module/delegation.rb
View
8 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 @@ def #{prefix}#{method}(*args, &block) # def customer_name(*args, &
#{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
Please sign in to comment.
Something went wrong with that request. Please try again.