lib/goby/entity/entity.rb
def remove_item(item, amount = 1)

      # Decrease the amount if the item already exists in the inventory.
      @inventory.each_with_index do |couple, index|
        if (couple.first == item)
          couple.second -= amount

          # Delete the item if the amount becomes non-positive.
          @inventory.delete_at(index) if couple.second.nonpositive?

          return
        end
      end
    end
# Removes the item, if it exists, and, at most, the given amount from the inventory.
#
# @param [Item] item the item being removed.
# @param [Integer] amount the amount of the item to remove.
Removes the item, if it exists, and, at most, the given amount from the inventory.
Removes the item if it exists and at most the given amount from the inventory .
def remove_item(item, amount = 1)
      @inventory.each_with_index do |couple, index|
        if (couple.first == item)
          couple.second -= amount
          @inventory.delete_at(index) if couple.second.nonpositive?
          return
        end
      end
    end
def remove_item ( item , amount = 1 ) @inventory . each_with_index do | couple , index | if ( couple . first == item ) couple . second -= amount @inventory . delete_at ( index ) if couple . second . nonpositive? return end end end
Removes the item, if it exists, and, at most, the given amount from the inventory.
Removes the item if it exists and at most the given amount from the inventory .
# Decrease the amount if the item already exists in the inventory. # Delete the item if the amount becomes non-positive.
item
amount
amount the amount of the item to remove.
amount the amount of the item to remove .