Class: System::Inventory
- Inherits:
-
Object
- Object
- System::Inventory
- Includes:
- Singleton
- Defined in:
- lib/inventory/inventory.rb
Class Method Summary collapse
- .add(amount, item) ⇒ Object
- .add_all(bag) ⇒ Object
- .has?(amount, item) ⇒ Boolean
- .invoice(name, *args) ⇒ Object
- .print ⇒ Object
- .remove(amount, item) ⇒ Object
- .remove_all(bag) ⇒ Object
Instance Method Summary collapse
-
#initialize ⇒ Inventory
constructor
A new instance of Inventory.
Constructor Details
Class Method Details
.add(amount, item) ⇒ Object
14 15 16 17 18 19 20 |
# File 'lib/inventory/inventory.rb', line 14 def self.add(amount, item) if amount > 2147483647 puts "Value must be less that 2147483647" else @bag.add(amount, item) end end |
.add_all(bag) ⇒ Object
22 23 24 |
# File 'lib/inventory/inventory.rb', line 22 def self.add_all(bag) @bag.add_all(bag) end |
.has?(amount, item) ⇒ Boolean
34 35 36 |
# File 'lib/inventory/inventory.rb', line 34 def self.has?(amount, item) @bag.has?(amount, item) end |
.invoice(name, *args) ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/inventory/inventory.rb', line 38 def self.invoice(name, *args) puts name this_order = args.at(0) index = 0 while index < this_order.size puts index item = this_order[index] puts item index += 1 amount = this_order[index] puts amount index += 1 # this order add stuff puts end #args.each do |i| #end end |
.print ⇒ Object
57 58 59 60 |
# File 'lib/inventory/inventory.rb', line 57 def self.print puts "INVENTORY: " @bag.print end |
.remove(amount, item) ⇒ Object
30 31 32 |
# File 'lib/inventory/inventory.rb', line 30 def self.remove(amount, item) @bag.remove(amount, item) end |
.remove_all(bag) ⇒ Object
26 27 28 |
# File 'lib/inventory/inventory.rb', line 26 def self.remove_all(bag) @bag.remove_all(bag) end |