Class: Lifo

Inherits:
Object
  • Object
show all
Defined in:
lib/fifo_lifo/lifo.rb

Instance Method Summary collapse

Constructor Details

#initialize(utils) ⇒ Lifo

Returns a new instance of Lifo.



2
3
4
# File 'lib/fifo_lifo/lifo.rb', line 2

def initialize(utils)
    @utils = utils
end

Instance Method Details

#get_profit_or_lost_with_lifoObject



5
6
7
8
9
# File 'lib/fifo_lifo/lifo.rb', line 5

def get_profit_or_lost_with_lifo
    list_purchases = @utils.reverse_array(@utils.get_purchase_and_prices[0])
    list_prices = @utils.reverse_array(@utils.get_purchase_and_prices[1])
    @utils.calculate_profit_or_loss(list_purchases,list_prices)
end