descriptive-statistics 1.1.1 → 1.2.1

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -3,6 +3,7 @@
3
3
  .bundle
4
4
  .config
5
5
  .yardoc
6
+ .idea
6
7
  Gemfile.lock
7
8
  InstalledFiles
8
9
  _yardoc
data/README.md CHANGED
@@ -33,6 +33,8 @@ stats.mode #=> 1
33
33
  ```ruby
34
34
  stats = DescriptiveStatistics.new([1,1,2,3,10])
35
35
  stats.range #=> 9
36
+ stats.min #=> 1
37
+ stats.range #=> 10
36
38
  stats.percentile_from_value(10) #=> 80
37
39
  stats.value_from_percentile(60) #=> 3
38
40
  ```
@@ -15,5 +15,5 @@ class DescriptiveStatistics
15
15
  @data = data
16
16
  end
17
17
 
18
- def_delegators :@data, :length, :inject, :sort, :each, :each_with_object
18
+ def_delegators :@data, :length, :inject, :sort, :each, :each_with_object, :min, :max
19
19
  end
@@ -1,5 +1,5 @@
1
1
  module Descriptive
2
2
  module Statistics
3
- VERSION = "1.1.1"
3
+ VERSION = "1.2.1"
4
4
  end
5
5
  end
@@ -11,6 +11,26 @@ describe DescriptiveStatistics::Dispersion do
11
11
  end
12
12
  end
13
13
 
14
+ describe '#min' do
15
+ it 'delegates to array' do
16
+ DescriptiveStatistics.new([1,2,6]).min.should == 1
17
+ end
18
+
19
+ it 'returns nil if empty' do
20
+ DescriptiveStatistics.new([]).min.should be_nil
21
+ end
22
+ end
23
+
24
+ describe '#max' do
25
+ it 'delegates to array' do
26
+ DescriptiveStatistics.new([1,2,6]).max.should == 6
27
+ end
28
+
29
+ it 'returns nil if empty' do
30
+ DescriptiveStatistics.new([]).max.should be_nil
31
+ end
32
+ end
33
+
14
34
  describe '#percentile_from_value' do
15
35
  it 'returns the precise percentile of each value' do
16
36
  data = [95.1772, 95.1567, 95.1937, 95.1959, 95.1442, 95.061, 95.1591, 95.1195,95.1065, 95.0925, 95.199, 95.1682]
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.1.1
4
+ version: 1.2.1
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-09-29 00:00:00.000000000 Z
12
+ date: 2012-10-02 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
@@ -82,7 +82,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
82
82
  version: '0'
83
83
  segments:
84
84
  - 0
85
- hash: 2077244715970886546
85
+ hash: 290274969783766992
86
86
  required_rubygems_version: !ruby/object:Gem::Requirement
87
87
  none: false
88
88
  requirements:
@@ -91,7 +91,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
91
91
  version: '0'
92
92
  segments:
93
93
  - 0
94
- hash: 2077244715970886546
94
+ hash: 290274969783766992
95
95
  requirements: []
96
96
  rubyforge_project:
97
97
  rubygems_version: 1.8.24