class Pcalci::Pcalculator
Public Class Methods
profit(bought, sold, type)
click to toggle source
# File lib/pcalci/pcalculator.rb, line 4 def self.profit bought, sold, type avg_bought = bought.inject(0) {|sum,(amount,price)| sum + amount*price } avg_sold = sold.inject(0) {|sum,(amount,price)| sum + amount*price } avg_sold - avg_bought end