Class: GroceryList::Item

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(item_name) ⇒ Item

Returns a new instance of Item.



5
6
7
# File 'lib/grocery_list/item.rb', line 5

def initialize(item_name)
  @item_name = item_name
end

Instance Attribute Details

#item_nameObject (readonly)

Returns the value of attribute item_name.



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

def item_name
  @item_name
end

Instance Method Details

#==(y) ⇒ Object



9
10
11
# File 'lib/grocery_list/item.rb', line 9

def ==(y)
  y.item_name == @item_name
end