From d0c697e9b17a9f22d645503a39f6d6d167d99b94 Mon Sep 17 00:00:00 2001 From: bogdanvlviv Date: Wed, 28 Feb 2018 00:05:46 +0200 Subject: Add separate test to ensure that `delegate` with `:private` option returns correct value Remove extra comments `# Asking for private method` in activesupport/test/core_ext/module_test.rb Improve docs of using `delegate` with `:private` Update changelog of #31944 --- activesupport/lib/active_support/core_ext/module/delegation.rb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'activesupport/lib/active_support/core_ext/module') diff --git a/activesupport/lib/active_support/core_ext/module/delegation.rb b/activesupport/lib/active_support/core_ext/module/delegation.rb index 426e34128f..45d16515d2 100644 --- a/activesupport/lib/active_support/core_ext/module/delegation.rb +++ b/activesupport/lib/active_support/core_ext/module/delegation.rb @@ -114,7 +114,7 @@ class Module # invoice.customer_name # => 'John Doe' # invoice.customer_address # => 'Vimmersvej 13' # - # If you want the delegated method to be a private method, + # If you want the delegate methods to be a private, # use the :private option. # # class User < ActiveRecord::Base @@ -127,10 +127,10 @@ class Module # end # end # - # User.new.age # 2 - # User.new.first_name # Tomas - # User.new.date_of_birth # NoMethodError: private method `date_of_birth' called for # - # User.new.religion # NoMethodError: private method `religion' called for # + # User.new.age # => 2 + # User.new.first_name # => "Tomas" + # User.new.date_of_birth # => NoMethodError: private method `date_of_birth' called for # + # User.new.religion # => NoMethodError: private method `religion' called for # # # If the target is +nil+ and does not respond to the delegated method a # +Module::DelegationError+ is raised. If you wish to instead return +nil+, -- cgit v1.2.3