From 1ae1099ed4c47d82b18a2ba8a9028ab06aff1f29 Mon Sep 17 00:00:00 2001 From: bogdanvlviv Date: Thu, 7 Jun 2018 21:39:08 +0300 Subject: [PATCH] Fix example of `index_with` - Clarify executor of `public_send`. - Do not wrap `Interval.all_day` into [] since an array is expected as a returned value. Related to #32523. [ci skip] --- guides/source/active_support_core_extensions.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/guides/source/active_support_core_extensions.md b/guides/source/active_support_core_extensions.md index 057651e0cf..8c9a890a4d 100644 --- a/guides/source/active_support_core_extensions.md +++ b/guides/source/active_support_core_extensions.md @@ -2045,10 +2045,10 @@ The method `index_with` generates a hash with the elements of an enumerable as k is either a passed default or returned in a block. ```ruby -%i( title body created_at ).index_with { |attr_name| public_send(attr_name) } +%i( title body created_at ).index_with { |attr_name| post.public_send(attr_name) } # => { title: "hey", body: "what's up?", … } -WEEKDAYS.index_with([ Interval.all_day ]) +WEEKDAYS.index_with(Interval.all_day) # => { monday: [ 0, 1440 ], … } ``` -- GitLab