未验证 提交 7b33903d 编写于 作者: G George Claghorn 提交者: GitHub

Merge pull request #33086 from bogdanvlviv/fix-index_with-in-guide

Fix example of `index_with`
......@@ -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 ], … }
```
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册