to_histogram 1.0.17 → 1.0.18
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.
- checksums.yaml +4 -4
- data/lib/stdout_print.rb +4 -3
- data/lib/to_histogram.rb +2 -2
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 53e90462b137cd4fa42556b11a0be8bdf93d775e
|
4
|
+
data.tar.gz: 3ee070a24472abad90330631e4932c6c9452b8b7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 36a08d9292cfcd9a7ea4b8a29483ea83e50c893664a00d2306182f208bf80ef9d925c1e49659b82aefbced3533b920a7818bc9ef208e00ded78cb961ad1718d4
|
7
|
+
data.tar.gz: 051fe4a85c0e7f7f0034d5a469be5010664956ebc1d75a2d5ec86ac80d5d17273b02f6c2ad479a661cafcda58bbc294d99d58da473d7efe3919eea79f6396d7e
|
data/lib/stdout_print.rb
CHANGED
@@ -5,9 +5,10 @@ module ToHistogram
|
|
5
5
|
class StdoutPrint
|
6
6
|
include Averages
|
7
7
|
|
8
|
-
def initialize(histogram, stdout=$stdout)
|
8
|
+
def initialize(histogram, stdout=$stdout, show_header: true)
|
9
9
|
@histogram = histogram
|
10
10
|
@stdout = stdout
|
11
|
+
@show_header = show_header
|
11
12
|
end
|
12
13
|
|
13
14
|
def invoke
|
@@ -16,7 +17,7 @@ module ToHistogram
|
|
16
17
|
elsif (@histogram.length == 1 && (@histogram[0].from == 0 && @histogram[0].to == -1))
|
17
18
|
@stdout.puts "The data you have provided is not histogram-able"
|
18
19
|
else
|
19
|
-
print_header
|
20
|
+
print_header if @show_header
|
20
21
|
print_body
|
21
22
|
end
|
22
23
|
end
|
@@ -24,7 +25,7 @@ module ToHistogram
|
|
24
25
|
private
|
25
26
|
def print_header
|
26
27
|
@stdout.print "\r**************************************************************\n"
|
27
|
-
@stdout.puts "Results for #to_histogram(num_buckets: #{@histogram.num_buckets}, bucket_width: #{@histogram.bucket_width}, percentile: #{@histogram.percentile}, print_info: true)"
|
28
|
+
@stdout.puts "Results for #to_histogram(num_buckets: #{@histogram.num_buckets}, bucket_width: #{@histogram.bucket_width}, percentile: #{@histogram.percentile}, print_info: true, print_header: #{@show_header})"
|
28
29
|
|
29
30
|
@stdout.puts "\n"
|
30
31
|
|
data/lib/to_histogram.rb
CHANGED
@@ -2,9 +2,9 @@ require_relative './histogram'
|
|
2
2
|
require_relative './stdout_print'
|
3
3
|
|
4
4
|
class Array
|
5
|
-
def to_histogram(num_buckets: 20, bucket_width: 'auto', percentile: 100, print_info: true)
|
5
|
+
def to_histogram(num_buckets: 20, bucket_width: 'auto', percentile: 100, print_info: true, print_header: true)
|
6
6
|
histogram = ToHistogram::Histogram.new(self, num_buckets: num_buckets, bucket_width: bucket_width, percentile: percentile)
|
7
|
-
stdout_print = ToHistogram::StdoutPrint.new(histogram)
|
7
|
+
stdout_print = ToHistogram::StdoutPrint.new(histogram, show_header: print_header)
|
8
8
|
|
9
9
|
stdout_print.invoke if print_info
|
10
10
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: to_histogram
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.18
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brett Sykes
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-04-02 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: 'Adds #to_histogram to Array. Returns a histogram distribution object
|
14
14
|
from an Array and optionally prints detailed info to stdout.'
|
@@ -43,7 +43,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
43
43
|
version: '0'
|
44
44
|
requirements: []
|
45
45
|
rubyforge_project:
|
46
|
-
rubygems_version: 2.5
|
46
|
+
rubygems_version: 2.4.5
|
47
47
|
signing_key:
|
48
48
|
specification_version: 4
|
49
49
|
summary: Creates a simple histogram output on the command line
|