Class: Taxbear::TableBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/taxbear/table_builder.rb

Class Method Summary collapse

Class Method Details

Takes the rates and prints them as a nice table to STDOUT.

Parameters:

  • rates (Hash)

    the rates

Returns:

  • (nil)

    returns nothing, prints to STDOUT



12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/taxbear/table_builder.rb', line 12

def print_rates_for_zipcode(rates, zipcode)
  output = ""
  output << "\n"
  output << Terminal::Table.new(
    title: "Sales Tax Rates for #{zipcode}",
    headings: align_each_cell_center(get_header_rows(rates)),
    rows: [align_each_cell_center(format_rates(rates))]
  ).to_s
  output << "\n\n"

  puts output
end