Class: Ordrin::Data::TrayItem
- Inherits:
-
Object
- Object
- Ordrin::Data::TrayItem
- Defined in:
- lib/ordrin/data.rb
Overview
Represents a single item in an order
Instance Method Summary collapse
-
#initialize(item_id, quantity, *options) ⇒ TrayItem
constructor
Store the descriptors of an order item in this object.
- #to_s ⇒ Object
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, *) @item_id = Normalize.normalize(item_id, :number) @quantity = Normalize.normalize(quantity, :number) @options = .map {|opt| Normalize.normalize(opt, :number)} end |
Instance Method Details
#to_s ⇒ Object
128 129 130 |
# File 'lib/ordrin/data.rb', line 128 def to_s "#{@item_id}/#{@quantity},#{@options*','}" end |