Skip to content

Commit

Permalink
rewords rdoc about :allow_nil in Module#delegate
Browse files Browse the repository at this point in the history
  • Loading branch information
fxn committed Jan 21, 2010
1 parent 6d70b93 commit 603112e
Showing 1 changed file with 4 additions and 4 deletions.
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 603112e

Please sign in to comment.