to_bar_graph 0.0.1 → 0.0.2

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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/stdout_print.rb +6 -10
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0e22264826b2a8f699c2d1cbda335530cb379233
4
- data.tar.gz: 133b2984e02e72394f6e72054980a6c80273d42e
3
+ metadata.gz: 092d59cfa67889a5aa4600a6ff0d6233c42f2c82
4
+ data.tar.gz: d67e8d5c77e6373df077e00023baabf6b3b04fcb
5
5
  SHA512:
6
- metadata.gz: b2f18f26df18b341ca06e6483c2a64cc8af77b37081fb0e0b3b217bd7ed7678d0225f3816e0d68267b1e6dbe46587d798f8c1e38ede80d8d7cca5a8dd6b974c3
7
- data.tar.gz: dcca6a48c325ef5ade4da636d2acac3c60f3d493826b8895ba6051262e4e95b0b5fb558b5309a768eec86ffec723db2a93d6dba63bf108105df92b95543af3e0
6
+ metadata.gz: e92c8d374e739d6d8bd7590b304c6d310e298980bb6a799833194840c0213db07b437fb5f6afbc5d8a6c048f4e82489f50034dde5f861cd8a2c85773d4738678
7
+ data.tar.gz: 3fad59c01191bd9cecc094d4589ec60eacabadef2bbdecc96cde2e26de1e246725e68f908675e19c7b3168a1dfd80ba0a64325d1a8fe12e32510a7f181a27f22
data/lib/stdout_print.rb CHANGED
@@ -10,22 +10,17 @@ module ToBarGraph
10
10
  def invoke
11
11
  if @bar_graph.length == 0
12
12
  @stdout.puts "You have no bar graph data"
13
- return
14
- end
15
-
16
- unless @bar_graph.buckets.is_a?(Hash)
13
+ elsif !(@bar_graph.buckets.is_a?(Hash))
17
14
  @stdout.puts "The data you have provided is not bargraph-able"
18
- return
15
+ else
16
+ print_header
17
+ print_body
19
18
  end
20
-
21
- print_header
22
-
23
- print_body
24
19
  end
25
20
 
26
21
  private
27
22
  def print_header
28
- @stdout.puts "\n**************************************************************"
23
+ @stdout.print "\r**************************************************************\n"
29
24
  @stdout.puts "Results for #to_bar_graph(print_info: true)"
30
25
  @stdout.puts "\n"
31
26
 
@@ -62,6 +57,7 @@ module ToBarGraph
62
57
  stars = ''
63
58
 
64
59
  percentage.ceil.times { |x| stars << '*' }
60
+ stars.length.upto(100) { |x| stars << ' ' }
65
61
 
66
62
  @stdout.printf("#{cata} | #{freq} | #{prec} | #{star} \n", ("#{cata_sig}" % category), frequency, ('%.4f' % percentage), stars)
67
63
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: to_bar_graph
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brett Sykes
@@ -41,7 +41,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
41
41
  version: '0'
42
42
  requirements: []
43
43
  rubyforge_project:
44
- rubygems_version: 2.4.5
44
+ rubygems_version: 2.5.0
45
45
  signing_key:
46
46
  specification_version: 4
47
47
  summary: Creates a simple bar graph on the command line