descriptive-statistics 1.3.5 → 1.3.6

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -8,6 +8,7 @@ ree
8
8
 
9
9
  [![Build Status](https://secure.travis-ci.org/jtescher/descriptive-statistics.png)]
10
10
  (http://travis-ci.org/jtescher/descriptive-statistics)
11
+ [![Dependency Status](https://gemnasium.com/jtescher/descriptive-statistics.png)](https://gemnasium.com/jtescher/descriptive-statistics)
11
12
  [![Code Climate](https://codeclimate.com/badge.png)](https://codeclimate.com/github/jtescher/descriptive-statistics)
12
13
  ## Installation
13
14
 
@@ -1,7 +1,11 @@
1
1
  class DescriptiveStatistics
2
2
  module CentralTendency
3
- def sum
4
- inject(0, :+)
3
+ def sum(identity = 0, &block)
4
+ if block_given?
5
+ map(&block).sum(identity)
6
+ else
7
+ inject(:+) || identity
8
+ end
5
9
  end
6
10
 
7
11
  def mean
@@ -1,5 +1,5 @@
1
1
  module Descriptive
2
2
  module Statistics
3
- VERSION = "1.3.5"
3
+ VERSION = "1.3.6"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: descriptive-statistics
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.5
4
+ version: 1.3.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-10-06 00:00:00.000000000 Z
12
+ date: 2012-10-26 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
@@ -85,7 +85,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
85
85
  version: '0'
86
86
  segments:
87
87
  - 0
88
- hash: 4156932844491246834
88
+ hash: 91225882488360211
89
89
  required_rubygems_version: !ruby/object:Gem::Requirement
90
90
  none: false
91
91
  requirements:
@@ -94,7 +94,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
94
94
  version: '0'
95
95
  segments:
96
96
  - 0
97
- hash: 4156932844491246834
97
+ hash: 91225882488360211
98
98
  requirements: []
99
99
  rubyforge_project:
100
100
  rubygems_version: 1.8.24