Sha256: 13e83c529cb6d0d04c62a96581768fd32ba9195c66db484d13b5e1fdec7637f4

Contents?: true

Size: 422 Bytes

Versions: 1

Compression:

Stored size: 422 Bytes

Contents

require 'shopscan'

class Terminal
  include ShopScan

  def add_item(item)
    @price_list ||= {}
    @price_list.merge! item
  end

  def product(product_name = nil)
    return self.all_products unless product_name

    @price_list[product_name.to_s.upcase]
  end

  def all_products
    @price_list
  end

  def items
    @items ||= []
  end

  def add_item_to_cart(item)
    @items ||= []
    @items << item
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
shopscan-0.0.1 lib/terminal.rb