From 00f49c74e8354e393ed4ffd6bfa8beb657c8920d Mon Sep 17 00:00:00 2001 From: Xavier Noria Date: Tue, 13 Jul 2010 23:35:58 +0200 Subject: AS guides: reword the docs of Enumerable#group_by --- railties/guides/source/active_support_core_extensions.textile | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'railties/guides/source/active_support_core_extensions.textile') diff --git a/railties/guides/source/active_support_core_extensions.textile b/railties/guides/source/active_support_core_extensions.textile index 58824d7aeb..097d51e007 100644 --- a/railties/guides/source/active_support_core_extensions.textile +++ b/railties/guides/source/active_support_core_extensions.textile @@ -1840,9 +1840,7 @@ h3. Extensions to +Enumerable+ h4. +group_by+ -Ruby 1.8.7 and up define +group_by+, and Active Support does it for previous versions. - -This iterator takes a block and builds an ordered hash with its return values as keys. Each key is mapped to the array of elements for which the block returned that value: +Active Support redefines +group_by+ in Ruby 1.8.7 so that it returns an ordered hash as in 1.9: entries_by_surname_initial = address_book.group_by do |entry| @@ -1850,7 +1848,7 @@ entries_by_surname_initial = address_book.group_by do |entry| end -WARNING. Active Support redefines +group_by+ in Ruby 1.8.7 so that it still returns an ordered hash. +Distinct block return values are added to the hash as they come, so that's the resulting order. NOTE: Defined in +active_support/core_ext/enumerable.rb+. -- cgit v1.2.3