Class: Item

Inherits:
Object
  • Object
show all
Defined in:
lib/item.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#idObject

Returns the value of attribute id.



2
3
4
# File 'lib/item.rb', line 2

def id
  @id
end

#nameObject

Returns the value of attribute name.



2
3
4
# File 'lib/item.rb', line 2

def name
  @name
end

#priceObject

Returns the value of attribute price.



2
3
4
# File 'lib/item.rb', line 2

def price
  @price
end