Class: ToBarGraph::StdoutPrint
- Inherits:
-
Object
- Object
- ToBarGraph::StdoutPrint
- Defined in:
- lib/stdout_print.rb
Instance Method Summary collapse
-
#initialize(bar_graph, stdout = $stdout) ⇒ StdoutPrint
constructor
A new instance of StdoutPrint.
- #invoke ⇒ Object
Constructor Details
#initialize(bar_graph, stdout = $stdout) ⇒ StdoutPrint
Returns a new instance of StdoutPrint.
5 6 7 8 |
# File 'lib/stdout_print.rb', line 5 def initialize(, stdout=$stdout) @bar_graph = @stdout = stdout end |
Instance Method Details
#invoke ⇒ Object
10 11 12 13 14 15 16 17 18 19 |
# File 'lib/stdout_print.rb', line 10 def invoke if @bar_graph.length == 0 @stdout.puts "You have no bar graph data" elsif !(@bar_graph.buckets.is_a?(Hash)) @stdout.puts "The data you have provided is not bargraph-able" else print_header print_body end end |