Class: TablePrinter
- Inherits:
-
Object
- Object
- TablePrinter
- Defined in:
- lib/table_printer.rb
Instance Method Summary collapse
-
#initialize(primes, io = STDOUT) ⇒ TablePrinter
constructor
A new instance of TablePrinter.
- #longest_digits ⇒ Object
- #print ⇒ Object
Constructor Details
#initialize(primes, io = STDOUT) ⇒ TablePrinter
5 6 7 8 9 |
# File 'lib/table_printer.rb', line 5 def initialize(primes, io=STDOUT) @primes = primes @table = MultiplicationTable.new(@primes).generate @io = io end |
Instance Method Details
#longest_digits ⇒ Object
16 17 18 |
# File 'lib/table_printer.rb', line 16 def longest_digits @longest_digits ||= @table.flatten.max.to_s.size end |
#print ⇒ Object
11 12 13 14 |
# File 'lib/table_printer.rb', line 11 def print print_header_row print_rows end |