Sha256: 6ddb31129316639dbdb530adc54faf3390a859b17cfca2d280f6c4d4e4f286c8

Contents?: true

Size: 441 Bytes

Versions: 1

Compression:

Stored size: 441 Bytes

Contents

module ShoppingList

  class Item

    attr_accessor :name, :store, :amount, :category

    def initialize(name, amount=1, category='none', location='none')
      @amount = amount
      @name = name
      @store = location
      @category = category
    end

    def to_hash
      {name: self.name, amount: self.amount, store: self.store, category: self.category}
    end

    def add_to_list
      $holding_list << self
    end

  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
shoppinglist-0.0.5.pre lib/shoppinglist/item.rb