class Calculator::PerItem < Calculator
  preference :amount, :decimal, :default => 0

  def self.description
    I18n.t("flat_rate_per_item")
  end

  def self.register
    super
    ShippingMethod.register_calculator(self)
  end

  def compute(line_items=nil)
    self.preferred_amount * line_items.length
  end
end

class Calculator::PerItem < Calculator
  preference :amount, :decimal, :default => 0

  def self.description
    I18n.t("flat_rate_per_item")
  end

  def self.register
    super
    ShippingMethod.register_calculator(self)
  end

  def compute(object=nil)
    self.preferred_amount * object.line_items.length
  end
end

Revert "Fix error in PerItem calculator"
Revert "Fix error in PerItem calculator"

This reverts commit 5f270b7ad263859c2da75f72ff0405e4ab1e770b.
