easystats 0.3.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/lib/easystats.rb +9 -8
  2. data/lib/easystats/version.rb +1 -1
  3. metadata +10 -10
data/lib/easystats.rb CHANGED
@@ -4,8 +4,9 @@ class Array
4
4
  return unless self.any?
5
5
 
6
6
  self.sum / self.count.to_f
7
- end unless Array.instance_methods.include? "mean"
8
- alias_method :average, :mean unless Array.instance_methods.include? "average"
7
+ end unless Array.method_defined? :mean
8
+
9
+ alias_method :average, :mean unless Array.method_defined? :average
9
10
 
10
11
  # take in the array of numbers and calculate the median
11
12
  def median
@@ -29,7 +30,7 @@ class Array
29
30
  end
30
31
 
31
32
  median
32
- end unless Array.instance_methods.include? "median"
33
+ end unless Array.method_defined? :median
33
34
 
34
35
  # take in an array of numbers and return the mode
35
36
  def mode
@@ -91,7 +92,7 @@ class Array
91
92
  highest_value
92
93
  end
93
94
  end
94
- end unless Array.instance_methods.include? "mode"
95
+ end unless Array.method_defined? :mode
95
96
 
96
97
  # take in an array of numbers and calculate the range
97
98
  def range
@@ -99,7 +100,7 @@ class Array
99
100
 
100
101
  data = self.sort
101
102
  data.last - data.first
102
- end unless Array.instance_methods.include? "range"
103
+ end unless Array.method_defined? :range
103
104
 
104
105
  # take in an array of numbers and calculate the standard deviation
105
106
  def standard_deviation
@@ -107,18 +108,18 @@ class Array
107
108
  return 0 if self.one?
108
109
 
109
110
  Math::sqrt(self.sum_of_deviations_squared / (self.count-1))
110
- end unless Array.instance_methods.include? "standard_deviation"
111
+ end unless Array.method_defined? :standard_deviation
111
112
 
112
113
  # take in an array of numbers and calculate the sum
113
114
  def sum
114
115
  self.reduce { |total, number| total + number }
115
- end unless Array.instance_methods.include? "sum"
116
+ end unless Array.method_defined? :sum
116
117
 
117
118
  def variance
118
119
  return unless self.any?
119
120
 
120
121
  self.sum_of_deviations_squared / self.count.to_f
121
- end unless Array.instance_methods.include? "variance"
122
+ end unless Array.method_defined? :variance
122
123
 
123
124
  protected
124
125
 
@@ -1,3 +1,3 @@
1
1
  module Easystats
2
- VERSION = "0.3.0"
2
+ VERSION = "0.3.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: easystats
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,11 +10,11 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2012-04-11 00:00:00.000000000 Z
13
+ date: 2012-04-12 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: guard-rspec
17
- requirement: &70146983589700 !ruby/object:Gem::Requirement
17
+ requirement: &70327162346300 !ruby/object:Gem::Requirement
18
18
  none: false
19
19
  requirements:
20
20
  - - ! '>='
@@ -22,10 +22,10 @@ dependencies:
22
22
  version: '0'
23
23
  type: :development
24
24
  prerelease: false
25
- version_requirements: *70146983589700
25
+ version_requirements: *70327162346300
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: rake
28
- requirement: &70146983589240 !ruby/object:Gem::Requirement
28
+ requirement: &70327162345840 !ruby/object:Gem::Requirement
29
29
  none: false
30
30
  requirements:
31
31
  - - ! '>='
@@ -33,10 +33,10 @@ dependencies:
33
33
  version: '0'
34
34
  type: :development
35
35
  prerelease: false
36
- version_requirements: *70146983589240
36
+ version_requirements: *70327162345840
37
37
  - !ruby/object:Gem::Dependency
38
38
  name: rspec
39
- requirement: &70146983588620 !ruby/object:Gem::Requirement
39
+ requirement: &70327162345260 !ruby/object:Gem::Requirement
40
40
  none: false
41
41
  requirements:
42
42
  - - ! '>='
@@ -44,10 +44,10 @@ dependencies:
44
44
  version: '0'
45
45
  type: :development
46
46
  prerelease: false
47
- version_requirements: *70146983588620
47
+ version_requirements: *70327162345260
48
48
  - !ruby/object:Gem::Dependency
49
49
  name: simplecov
50
- requirement: &70146983588020 !ruby/object:Gem::Requirement
50
+ requirement: &70327162344620 !ruby/object:Gem::Requirement
51
51
  none: false
52
52
  requirements:
53
53
  - - ! '>='
@@ -55,7 +55,7 @@ dependencies:
55
55
  version: '0'
56
56
  type: :development
57
57
  prerelease: false
58
- version_requirements: *70146983588020
58
+ version_requirements: *70327162344620
59
59
  description: This gem contains statistics functions that are very easy to use. Much
60
60
  easier and much more complete than many of the other statistical gems available
61
61
  out there. If you need a feature added, send me a message on Github!