Add BuyXGetOneFreeDiscount

This commit is contained in:
David Underwood
2026-07-21 12:23:46 -04:00
parent 882c18b5e6
commit 554ce58cbf
6 changed files with 70 additions and 15 deletions
+7 -1
View File
@@ -1,8 +1,10 @@
require 'no_discount.rb'
class Product
def initialize(price: 0.00, id:, description: '')
def initialize(price: 0.00, id:, discount: nil, description: '')
@price = price
@id = id
@description = description
@discount = discount || NoDiscount.new
end
def price
@@ -13,6 +15,10 @@ class Product
@id
end
def discount
@discount
end
def description
@description
end