From 34a10e0c414548849c7ff3a0879a58dc0d84a9a4 Mon Sep 17 00:00:00 2001 From: Yoshiyuki Hirano <yhirano@me.com> Date: Wed, 4 Apr 2018 20:04:10 +0900 Subject: [ci skip] Add :private option to delegate section in guide --- guides/source/active_support_core_extensions.md | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'guides') diff --git a/guides/source/active_support_core_extensions.md b/guides/source/active_support_core_extensions.md index 75ad343613..ae2e1faf14 100644 --- a/guides/source/active_support_core_extensions.md +++ b/guides/source/active_support_core_extensions.md @@ -779,6 +779,14 @@ delegate :size, to: :attachment, prefix: :avatar In the previous example the macro generates `avatar_size` rather than `size`. +The option `:private` changes methods scope: + +```ruby +delegate :date_of_birth, to: :profile, private: true +``` + +The delegated methods are public by default. Pass `private: true` to change that. + NOTE: Defined in `active_support/core_ext/module/delegation.rb` #### `delegate_missing_to` -- cgit v1.2.3