Class: Ordrin::Data::TrayItem

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

Overview

Represents a single item in an order

Instance Method Summary collapse

Constructor Details

#initialize(item_id, quantity, *options) ⇒ TrayItem

Store the descriptors of an order item in this object. Arguments: item_id – the restaurants’s numerial ID for the item quantity – the quantity options – any number of options to apply to the item



122
123
124
125
126
# File 'lib/ordrin/data.rb', line 122

def initialize(item_id, quantity, *options)
  @item_id = Normalize.normalize(item_id, :number)
  @quantity = Normalize.normalize(quantity, :number)
  @options = options.map {|opt| Normalize.normalize(opt, :number)}
end

Instance Method Details

#to_sObject



128
129
130
# File 'lib/ordrin/data.rb', line 128

def to_s
  "#{@item_id}/#{@quantity},#{@options*','}"
end