diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2006-06-24 16:14:59 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2006-06-24 16:14:59 +0000 |
commit | fd0eaaa407fb8fd704967be2734c1b094ac630d9 (patch) | |
tree | e6b8d271e1f70ab38a15faafde16f80abd6e1322 /activesupport/CHANGELOG | |
parent | 8b89bd779a1ddc78da63de295574b8519c3e94c8 (diff) | |
download | rails-fd0eaaa407fb8fd704967be2734c1b094ac630d9.tar.gz rails-fd0eaaa407fb8fd704967be2734c1b094ac630d9.tar.bz2 rails-fd0eaaa407fb8fd704967be2734c1b094ac630d9.zip |
Added Enumerable#sum for calculating a sum from the elements [DHH]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4489 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activesupport/CHANGELOG')
-rw-r--r-- | activesupport/CHANGELOG | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/activesupport/CHANGELOG b/activesupport/CHANGELOG index 092c42ed3f..ed820edd73 100644 --- a/activesupport/CHANGELOG +++ b/activesupport/CHANGELOG @@ -1,5 +1,12 @@ *SVN* +* Added Enumerable#sum for calculating a sum from the elements [DHH]. Examples: + + payments.sum { |p| p.price * p.tax_rate } + payments.sum(&:price) + + This is instead of payments.inject(0) { |sum, p| sum + p.price } + * Correct and clarify Array#to_sentence docs. #5458 [brad@madriska.com] * alias_method_chain preserves method punctuation so foo, foo?, and foo! may be chained with the same feature. [Jeremy Kemper] |