class Print

Attributes

checkouts[R]

Public Class Methods

new(checkouts) click to toggle source
# File lib/wunder/print.rb, line 7
def initialize(checkouts)
  @checkouts = checkouts
end

Public Instance Methods

table() click to toggle source
# File lib/wunder/print.rb, line 11
def table
  rows = []
  headings = ["", "Items In basket", "Applied Promo Rules", "Total Price"]
  checkouts.each_with_index do |checkout, index|
    price = Money.new(checkout.total * 100).format
    items = checkout.basket.items_in_basket
    applied_promotional_rules = checkout.applied_promotional_rules

    rows << ["Test_#{index}", items, applied_promotional_rules, price]
  end
  Terminal::Table.new headings: headings, rows: rows
end