to_bar_graph 0.0.3 → 0.0.4

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 934d4994a754c78b54375842e37c10e378971948
4
- data.tar.gz: 9da9dfe3a9dbdaf1b10059d21cfcae24f89ceb15
3
+ metadata.gz: 6be83b994a14633f88870cd7bdf7677dab514727
4
+ data.tar.gz: 80b106e49d827541f30ddbeca81ae6cb9451871c
5
5
  SHA512:
6
- metadata.gz: 3e3a895cc2b085be3fcae0079561e094acfa787a8f7157fb33746af5b97154916592e987c0bbb8447fe77368d9669855b9a8bc7c770881224fe4c32a6cd856b4
7
- data.tar.gz: 9748492885997d62cb52443b01df734cb178b6648a27c5a15154db4c1d83bb33e2d59287a1083d6fbbb22b25f9e51e014a5656acd2ee56fbed8ece1534f9f4bf
6
+ metadata.gz: 8f759a729c023f936a87ddbfef4b568ba0ab6e947f48db37c9ed0e676519cd6bc483669022a6b0fe07f9e24a276feb33e69b488a1edb5dd8fdee145badaada1e
7
+ data.tar.gz: 30b09f4f5ef3eeadcec3f9484ee08ca482350ec120691b76a31639ca054a4783a8434c82a9346a30ec39f53b0c53620eebe864b4cf34c831dfc1a8d28fa7eb80
data/lib/stdout_print.rb CHANGED
@@ -2,9 +2,10 @@ module ToBarGraph
2
2
 
3
3
  class StdoutPrint
4
4
 
5
- def initialize(bar_graph, stdout=$stdout)
5
+ def initialize(bar_graph, stdout=$stdout, show_header: true)
6
6
  @bar_graph = bar_graph
7
7
  @stdout = stdout
8
+ @show_header = show_header
8
9
  end
9
10
 
10
11
  def invoke
@@ -13,7 +14,7 @@ module ToBarGraph
13
14
  elsif !(@bar_graph.buckets.is_a?(Hash))
14
15
  @stdout.puts "The data you have provided is not bargraph-able"
15
16
  else
16
- print_header
17
+ print_header if @show_header
17
18
  print_body
18
19
  end
19
20
  end
@@ -21,7 +22,7 @@ module ToBarGraph
21
22
  private
22
23
  def print_header
23
24
  @stdout.print "\r**************************************************************\n"
24
- @stdout.puts "Results for #to_bar_graph(print_info: true)"
25
+ @stdout.puts "Results for #to_bar_graph(print_info: true, print_header: #{@show_header})"
25
26
  @stdout.puts "\n"
26
27
 
27
28
  @stdout.puts "Data set Size: #{@bar_graph.bucket_contents_length} items"
data/lib/to_bar_graph.rb CHANGED
@@ -3,9 +3,9 @@ require_relative './stdout_print'
3
3
 
4
4
  ['Array', 'Hash'].each do |c|
5
5
  eval "class #{Object.const_get(c)};
6
- def to_bar_graph(print_info: true);
6
+ def to_bar_graph(print_info: true, print_header: true);
7
7
  bar_graph = ToBarGraph::BarGraph.new(self);
8
- stdout_print = ToBarGraph::StdoutPrint.new(bar_graph);
8
+ stdout_print = ToBarGraph::StdoutPrint.new(bar_graph, show_header: print_header);
9
9
  stdout_print.invoke if print_info;
10
10
  return bar_graph;
11
11
  end;
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: to_bar_graph
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
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_bar_graph to Array and to Hash, returns a bar graph object,
14
14
  and optionally prints a simple bar graph to stdout.'
@@ -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.5.0
44
+ rubygems_version: 2.4.5
45
45
  signing_key:
46
46
  specification_version: 4
47
47
  summary: Creates a simple bar graph on the command line