aboutsummaryrefslogtreecommitdiffstats
path: root/railties
diff options
context:
space:
mode:
authorXavier Noria <fxn@hashref.com>2010-07-13 23:35:58 +0200
committerXavier Noria <fxn@hashref.com>2010-07-13 23:36:29 +0200
commit00f49c74e8354e393ed4ffd6bfa8beb657c8920d (patch)
treebb88edb5589c6f495afd8a2bebced435ab6621ef /railties
parentedb5401039ee15c37b201244c5dbf660bed51fb4 (diff)
downloadrails-00f49c74e8354e393ed4ffd6bfa8beb657c8920d.tar.gz
rails-00f49c74e8354e393ed4ffd6bfa8beb657c8920d.tar.bz2
rails-00f49c74e8354e393ed4ffd6bfa8beb657c8920d.zip
AS guides: reword the docs of Enumerable#group_by
Diffstat (limited to 'railties')
-rw-r--r--railties/guides/source/active_support_core_extensions.textile6
1 files changed, 2 insertions, 4 deletions
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:
<ruby>
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
</ruby>
-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+.