to_histogram 1.0.5 → 1.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/histogram.rb +4 -0
- data/lib/stdout_print.rb +1 -1
- data/lib/to_histogram.rb +3 -4
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a4478baf8c93b742601adc04a6c7828a3abba17c
|
4
|
+
data.tar.gz: 2664f02f676edc3069ff6366595971537cf6d8c9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3bd0b390d987fd206f9e3f064f85e575404c40dc5934b73ca34a62350c9be406b25eef9da3926dab9d0ab72130d5ea572ac06d9454b7c4241ace97e6ff98f3b5
|
7
|
+
data.tar.gz: aa761627dba1416ad3f9d891ddd2daa9d7b9aae0de28bd72b837dd308b83a4d489a0c869148dbf84966a215e3faf9be0d702b44cd52a4dc2fa7606ca938f2fe0
|
data/lib/histogram.rb
CHANGED
data/lib/stdout_print.rb
CHANGED
@@ -15,7 +15,7 @@ module ToHistogram
|
|
15
15
|
private
|
16
16
|
def print_header
|
17
17
|
puts "\n**************************************************************"
|
18
|
-
puts "Results for #to_histogram(num_buckets: #{@histogram.num_buckets}, percentile: #{@histogram.percentile})"
|
18
|
+
puts "Results for #to_histogram(num_buckets: #{@histogram.num_buckets}, percentile: #{@histogram.percentile}, print_info: true)"
|
19
19
|
puts "\n"
|
20
20
|
puts "Min Value: #{@original_array[0]}, Max Value: #{@original_array[-1]}"
|
21
21
|
puts "Mean: #{mean}, Median: #{median}, Mode: #{mode}"
|
data/lib/to_histogram.rb
CHANGED
@@ -2,13 +2,12 @@ require_relative './histogram'
|
|
2
2
|
require_relative './stdout_print'
|
3
3
|
|
4
4
|
class Array
|
5
|
-
def to_histogram(num_buckets: 10, percentile: 100)
|
5
|
+
def to_histogram(num_buckets: 10, percentile: 100, print_info: true)
|
6
6
|
histogram = ToHistogram::Histogram.new(self, num_buckets, percentile)
|
7
7
|
stdout_print = ToHistogram::StdoutPrint.new(histogram, self)
|
8
8
|
|
9
|
-
stdout_print.invoke
|
9
|
+
stdout_print.invoke if print_info
|
10
10
|
|
11
|
-
|
12
|
-
return nil
|
11
|
+
return histogram
|
13
12
|
end
|
14
13
|
end
|