Class: Product
- Inherits:
-
Object
- Object
- Product
- Defined in:
- lib/machine/product.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#price ⇒ Object
readonly
Returns the value of attribute price.
Instance Method Summary collapse
- #cash_value ⇒ Object
-
#initialize(name:, price:) ⇒ Product
constructor
A new instance of Product.
Constructor Details
#initialize(name:, price:) ⇒ Product
Returns a new instance of Product.
6 7 8 9 |
# File 'lib/machine/product.rb', line 6 def initialize(name:, price:) @name = name @price = price end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
4 5 6 |
# File 'lib/machine/product.rb', line 4 def name @name end |
#price ⇒ Object (readonly)
Returns the value of attribute price.
4 5 6 |
# File 'lib/machine/product.rb', line 4 def price @price end |
Instance Method Details
#cash_value ⇒ Object
11 12 13 |
# File 'lib/machine/product.rb', line 11 def cash_value Cash.cash_value(price) end |