Skip to content

Instantly share code, notes, and snippets.

@jordanhudgens
Last active August 17, 2016 22:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jordanhudgens/1859b1bbde7926af720cc8459e51a07f to your computer and use it in GitHub Desktop.
Save jordanhudgens/1859b1bbde7926af720cc8459e51a07f to your computer and use it in GitHub Desktop.
class OrderReport
def initialize(customer:, total:)
@customer = customer
@total = total
end
end
class Invoice < OrderReport
def print_out
puts "Invoice"
puts @customer
puts @total
end
end
class BillOfLading < OrderReport
def initialize(address:, **args)
super(**args)
@address = address
end
def print_out
puts "BOL"
puts @customer
puts "Shiping Label..."
puts @address
end
end
invoice = Invoice.new(customer: "Google", total: 100)
bill_of_lading = BillOfLading.new(customer: "Yahoo", total: 200, address: "123 Any Street")
invoice.print_out
bill_of_lading.print_out
# Invoice
# Google
# 100
# BOL
# Yahoo
# Shiping Label...
# 123 Any Street
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment