aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/CHANGELOG
diff options
context:
space:
mode:
authorMarcel Molina <marcel@vernix.org>2006-03-01 20:32:10 +0000
committerMarcel Molina <marcel@vernix.org>2006-03-01 20:32:10 +0000
commit1fdf578c17b38fc5391996d2016f4170bc3bf5ba (patch)
tree6063dbbf0043d0f187d6655c0ccbade2b1fc4ca4 /activesupport/CHANGELOG
parent8368b5960b5128deed17fcf9d7cda5c70da9d972 (diff)
downloadrails-1fdf578c17b38fc5391996d2016f4170bc3bf5ba.tar.gz
rails-1fdf578c17b38fc5391996d2016f4170bc3bf5ba.tar.bz2
rails-1fdf578c17b38fc5391996d2016f4170bc3bf5ba.zip
Add Enumerable#group_by and Array#in_groups_of
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3726 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activesupport/CHANGELOG')
-rw-r--r--activesupport/CHANGELOG25
1 files changed, 25 insertions, 0 deletions
diff --git a/activesupport/CHANGELOG b/activesupport/CHANGELOG
index 7e20faecfa..0ed194591c 100644
--- a/activesupport/CHANGELOG
+++ b/activesupport/CHANGELOG
@@ -1,5 +1,30 @@
*SVN*
+* Add Enumerable#group_by for grouping collections based on the result of some
+ block. Useful, for example, for grouping records by date.
+
+ ex.
+
+ latest_transcripts.group_by(&:day).each do |day, transcripts|
+ p "#{day} -> #{transcripts.map(&:class) * ', '}"
+ end
+ "2006-03-01 -> Transcript"
+ "2006-02-28 -> Transcript"
+ "2006-02-27 -> Transcript, Transcript"
+ "2006-02-26 -> Transcript, Transcript"
+
+ Add Array#in_groups_of, for iterating over an array in groups of a certain
+ size.
+
+ ex.
+
+ %w(1 2 3 4 5 6 7).in_groups_of(3) {|g| p g}
+ ["1", "2", "3"]
+ ["4", "5", "6"]
+ ["7", nil, nil]
+
+ [Marcel Molina Jr., Sam Stephenson]
+
* Added Kernel#daemonize to turn the current process into a daemon that can be killed with a TERM signal [DHH]
* Add 'around' methods to Logger, to make it easy to log before and after messages for a given block as requested in #3809. [Michael Koziarski] Example: