diff options
author | Ryuta Kamizono <kamipo@gmail.com> | 2018-02-28 18:03:21 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-02-28 18:03:21 +0900 |
commit | e6d6d73d54584a6d5e69c3e63b5e8c884729330b (patch) | |
tree | 0a07b269764d559126e8b466965b3781f5c5a804 /activesupport/lib | |
parent | 3a7a21edb2425d305b8b3b2e173bd53285d55f64 (diff) | |
parent | d0c697e9b17a9f22d645503a39f6d6d167d99b94 (diff) | |
download | rails-e6d6d73d54584a6d5e69c3e63b5e8c884729330b.tar.gz rails-e6d6d73d54584a6d5e69c3e63b5e8c884729330b.tar.bz2 rails-e6d6d73d54584a6d5e69c3e63b5e8c884729330b.zip |
Merge pull request #32133 from bogdanvlviv/delegate-with-private
Add separate test to ensure that `delegate` with `:private` option returns correct value
Diffstat (limited to 'activesupport/lib')
-rw-r--r-- | activesupport/lib/active_support/core_ext/module/delegation.rb | 10 |
1 files changed, 5 insertions, 5 deletions
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 <tt>:private</tt> 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:0x00000008221340> - # User.new.religion # NoMethodError: private method `religion' called for #<User:0x00000008221340> + # User.new.age # => 2 + # User.new.first_name # => "Tomas" + # User.new.date_of_birth # => NoMethodError: private method `date_of_birth' called for #<User:0x00000008221340> + # User.new.religion # => NoMethodError: private method `religion' called for #<User:0x00000008221340> # # 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+, |