to_histogram 1.0.17 → 1.0.18

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: 88a165ff8fb7ec704bceca532ce7e55042385d4c
4
- data.tar.gz: c095f32ec744f8a4b2fec879cab8bb9015410210
3
+ metadata.gz: 53e90462b137cd4fa42556b11a0be8bdf93d775e
4
+ data.tar.gz: 3ee070a24472abad90330631e4932c6c9452b8b7
5
5
  SHA512:
6
- metadata.gz: aec985b4a5b08c3b4237b19dbf1a5872b6b392bb0d582a91de618152fb2a991326c19624336a5cdd4a456818b97a08b820d08c6522e2c04aebea9229b50594af
7
- data.tar.gz: 2adb6382f68cbf4fba8f26a2f2d40ec790aa7858b8c07ab3c8f7773697630e89b988a03e1f9c4daeefb1dc71246ed9abd1a5970c9e1b510f56146a16c11323dc
6
+ metadata.gz: 36a08d9292cfcd9a7ea4b8a29483ea83e50c893664a00d2306182f208bf80ef9d925c1e49659b82aefbced3533b920a7818bc9ef208e00ded78cb961ad1718d4
7
+ data.tar.gz: 051fe4a85c0e7f7f0034d5a469be5010664956ebc1d75a2d5ec86ac80d5d17273b02f6c2ad479a661cafcda58bbc294d99d58da473d7efe3919eea79f6396d7e
@@ -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
 
@@ -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.17
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: 2015-12-02 00:00:00.000000000 Z
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.0
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