bootstripe 0.2.10 → 0.2.11

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,4 +1,8 @@
1
1
  class Array
2
+ def sum
3
+ self.inject(:+)
4
+ end
5
+
2
6
  def mean
3
7
  sum / size
4
8
  end
@@ -1,3 +1,3 @@
1
1
  module Bootstripe
2
- VERSION = "0.2.10"
2
+ VERSION = "0.2.11"
3
3
  end
@@ -2,6 +2,16 @@ require 'spec_helper'
2
2
 
3
3
  describe Array do
4
4
 
5
+ it 'should sum members' do
6
+ [1,2,3,4,5].sum.should == 15
7
+ [1.5, 5.6].sum.should == 7.1
8
+ end
9
+
10
+ it 'should find the mean of members' do
11
+ [1,2,3,4,5].mean.should == 3
12
+ [1.5, 5.6].mean.should == 3.55
13
+ end
14
+
5
15
  it 'should compact blank objects and leave non-blank objects in place' do
6
16
  [0, 1, 2, 3].compakt.should == [0, 1, 2, 3]
7
17
  [0, nil, 'awesome sauce'].compakt.should == [0, 'awesome sauce']
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bootstripe
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.10
4
+ version: 0.2.11
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2012-04-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
16
- requirement: &70169918865840 !ruby/object:Gem::Requirement
16
+ requirement: &70118455067880 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,7 +21,7 @@ dependencies:
21
21
  version: '0'
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *70169918865840
24
+ version_requirements: *70118455067880
25
25
  description: A handful of useful additions for Ruby
26
26
  email:
27
27
  - mike@bytebin.com