Sort Collection Struct Objects

Ruby

Given the Struct below with 3 companies, sort them in descending order by the total.

Create a method called total_sorter that accepts one parameter, which are the invoices.

Invoice = Struct.new(:name, :total, :category)

Invoice.new('Google', 500, 'Marketing')
Invoice.new('Amazon', 1000, 'eCommerce')
Invoice.new('Yahoo', 300, 'Marketing')
def total_sorter invoices end
< >