Add BuyXGetOneFreeDiscount
This commit is contained in:
+7
-1
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user