mobj 1.7.4 → 1.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. data/lib/mobj.rb +8 -0
  2. metadata +2 -2
data/lib/mobj.rb CHANGED
@@ -157,6 +157,14 @@ module Mobj
157
157
  alias includes? include?
158
158
  alias contains? include?
159
159
 
160
+ def sum(initial = 0.0, op = :+, &block)
161
+ map(&:to_f).inject(initial, block ? block : op)
162
+ end
163
+
164
+ def avg(&block)
165
+ sum(&block) / size
166
+ end
167
+
160
168
  def values() self end
161
169
  def sequester(crush = true)
162
170
  if crush
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mobj
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.4
4
+ version: 1.8.0
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-12-20 00:00:00.000000000 Z
12
+ date: 2012-12-24 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec