to_histogram 1.0.15 → 1.0.16

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/stdout_print.rb +6 -10
  3. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b8e294f1f6f40a95f9222824e814746354411458
4
- data.tar.gz: 93649a49d4317c8871e2c576e3dc718753b63405
3
+ metadata.gz: f9f9630dbdff3b9465ee3696e6d5a8d73d3a5e5e
4
+ data.tar.gz: 3121fc6706557f2c124357c44909ff87756caec6
5
5
  SHA512:
6
- metadata.gz: a7cbb0fd3f00d822757cdedcab9e72beab79b200d3f4bb776bd3891f319625af836e193ffa683af0baef788869b5e15ad8e02f7350b8805dd4fcbf4f6be13fc2
7
- data.tar.gz: 305f250ac56e02b790d03683cc240474d18ec1106274403f44be1be6272b8eafda703c6a8327b20d3c3e75dd00cbae2e636feeef94a5ae029a5d15888207eae3
6
+ metadata.gz: 2bb9704b379519eb81d97954179bd2d730d8a021a0238ef3b1546f252513570c66875f0d34ede5d2bc45c1d0892c671021fd78c09c0027bd013147cdf5e34b7c
7
+ data.tar.gz: 0928606f6d502f7dc9f6bced7d56bce330a29203c443aaed0ba7e9b782279b90acc420b9c43fb631ab71b4b1c55e38a1fc444f4e7829d9c284b5dba82ff111dd
data/lib/stdout_print.rb CHANGED
@@ -13,22 +13,17 @@ module ToHistogram
13
13
  def invoke
14
14
  if @histogram.length == 0
15
15
  @stdout.puts "You have no histogram data"
16
- return
17
- end
18
-
19
- if (@histogram.length == 1 && (@histogram[0].from == 0 && @histogram[0].to == -1))
16
+ elsif (@histogram.length == 1 && (@histogram[0].from == 0 && @histogram[0].to == -1))
20
17
  @stdout.puts "The data you have provided is not histogram-able"
21
- return
18
+ else
19
+ print_header
20
+ print_body
22
21
  end
23
-
24
- print_header
25
-
26
- print_body
27
22
  end
28
23
 
29
24
  private
30
25
  def print_header
31
- @stdout.puts "\n**************************************************************"
26
+ @stdout.print "\r**************************************************************\n"
32
27
  @stdout.puts "Results for #to_histogram(num_buckets: #{@histogram.num_buckets}, bucket_width: #{@histogram.bucket_width}, percentile: #{@histogram.percentile}, print_info: true)"
33
28
 
34
29
  @stdout.puts "\n"
@@ -55,6 +50,7 @@ module ToHistogram
55
50
  stars = ''
56
51
 
57
52
  percentage.ceil.times { |x| stars << '*' }
53
+ stars.length.upto(100) { |x| stars << ' ' }
58
54
 
59
55
  if(i == (@histogram.length - 1))
60
56
  if(b.contents[-1] - b.contents[0] != 0 && (b.contents[-1] - b.contents[0] > @histogram.bucket_width))
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.15
4
+ version: 1.0.16
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-11-10 00:00:00.000000000 Z
11
+ date: 2015-11-17 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.4.5
46
+ rubygems_version: 2.5.0
47
47
  signing_key:
48
48
  specification_version: 4
49
49
  summary: Creates a simple histogram output on the command line