Class: Item
- Inherits:
-
Object
- Object
- Item
- Defined in:
- lib/item.rb
Instance Attribute Summary collapse
-
#id ⇒ Object
Returns the value of attribute id.
-
#name ⇒ Object
Returns the value of attribute name.
-
#price ⇒ Object
Returns the value of attribute price.
Instance Method Summary collapse
-
#initialize(attr = {}) ⇒ Item
constructor
A new instance of Item.
Constructor Details
#initialize(attr = {}) ⇒ Item
Returns a new instance of Item.
4 5 6 7 8 |
# File 'lib/item.rb', line 4 def initialize(attr = {}) @id = attr[:id] @price = attr[:price] @name = attr[:name] end |
Instance Attribute Details
#id ⇒ Object
Returns the value of attribute id.
2 3 4 |
# File 'lib/item.rb', line 2 def id @id end |
#name ⇒ Object
Returns the value of attribute name.
2 3 4 |
# File 'lib/item.rb', line 2 def name @name end |
#price ⇒ Object
Returns the value of attribute price.
2 3 4 |
# File 'lib/item.rb', line 2 def price @price end |