flash_extensions 3.2.0 → 3.2.1
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 99dac26e58f923bbf2daa7719f51b61738fc45aa
|
4
|
+
data.tar.gz: 54be7232e912e4079654e4e5fd672b482b3b70aa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c8427a50a81aac4ba4810d74de7a4dcf4bd37617a19c2b130292610a34a9a3ffa3dc3499574a5153d635d04a9c7cc326b73bf968d2aa75e019d1c2620ad15a56
|
7
|
+
data.tar.gz: 0cde6abc20782ed2a26f25ffa67e151ccaffe5eee403a0c6ccca028b2661e3a9306115618407197af5e277e1043e3f621cc5d1f46aaf7e3e2142116e75ab0871
|
@@ -111,7 +111,7 @@ module Enumerable
|
|
111
111
|
end
|
112
112
|
|
113
113
|
def standard_deviation
|
114
|
-
return if length < 2
|
114
|
+
return 0 if length < 2
|
115
115
|
Math.sqrt(variance)
|
116
116
|
end
|
117
117
|
|
@@ -133,7 +133,7 @@ module Enumerable
|
|
133
133
|
def variance
|
134
134
|
collection_length = length
|
135
135
|
|
136
|
-
return if collection_length < 1
|
136
|
+
return 0 if collection_length < 1
|
137
137
|
sum = inject(0) { |accumulator, value| accumulator + (value - mean) ** 2 }
|
138
138
|
sum / (collection_length.to_f - 1)
|
139
139
|
end
|
@@ -164,11 +164,11 @@ describe Enumerable do
|
|
164
164
|
end
|
165
165
|
|
166
166
|
it 'to be nil for single element arrays' do
|
167
|
-
expect([1].standard_deviation).to
|
167
|
+
expect([1].standard_deviation).to eq(0)
|
168
168
|
end
|
169
169
|
|
170
170
|
it 'to be nil if empty' do
|
171
|
-
expect([].standard_deviation).to
|
171
|
+
expect([].standard_deviation).to eq(0)
|
172
172
|
end
|
173
173
|
end
|
174
174
|
|
@@ -212,7 +212,7 @@ describe Enumerable do
|
|
212
212
|
end
|
213
213
|
|
214
214
|
it 'to be nil if empty' do
|
215
|
-
expect([].variance).to
|
215
|
+
expect([].variance).to eq(0)
|
216
216
|
end
|
217
217
|
end
|
218
218
|
|