ar_result_calculations 0.0.4 → 0.0.5

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.
data/CHANGELOG CHANGED
@@ -1,4 +1,4 @@
1
- ar_result_calculations (0.0.4) December 2, 2010
1
+ ar_result_calculations (0.0.4, 0.0.5) December 2, 2010
2
2
 
3
3
  * Add calculations for median and mode
4
4
 
@@ -31,6 +31,7 @@ p. All methods take one parameter (column name).
31
31
  |sample_variance|Calculates the sample variance of a column (for active record result sets) or self (for an array)|
32
32
  |standard_deviation|Calculates the standard deviation of a column (for active record result sets) or self (for an array)|
33
33
  |median|Calculates the median of a column (for active record result sets) or self (for an array)|
34
+ |mode|Calculates the mode of a column (for active record result sets) or self (for an array)|
34
35
 
35
36
  h1. License
36
37
 
@@ -117,7 +117,7 @@ module ArResultCalculations
117
117
  return nil if data.empty?
118
118
  data = data.sort unless options[:already_sorted]
119
119
  median_position = length / 2
120
- length_is_even? ? data[median_position] : mean(data[median_position - 1..median_position])
120
+ length_is_even? ? data[median_position-1..median_position].mean : data[median_position]
121
121
  end
122
122
 
123
123
  # Return the mode(s) of a column in an active record result set (or self)
@@ -1,3 +1,3 @@
1
1
  module ArResultCalculations
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ar_result_calculations
3
3
  version: !ruby/object:Gem::Version
4
- hash: 23
4
+ hash: 21
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 4
10
- version: 0.0.4
9
+ - 5
10
+ version: 0.0.5
11
11
  platform: ruby
12
12
  authors:
13
13
  - Kip Cole