Sha256: b1444b021983f6e243e5f5733045fa23dbcec9abf0afc7f54fdd9391634f2f5d
Contents?: true
Size: 360 Bytes
Versions: 1
Compression:
Stored size: 360 Bytes
Contents
module Spree class Calculator::PerItem < Calculator preference :amount, :decimal, :default => 0 def self.description I18n.t(:flat_rate_per_item) end def compute(object=nil) return 0 if object.nil? self.preferred_amount * object.line_items.reduce(0) do |sum, value| sum + value.quantity end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
spree_core-1.0.4 | app/models/spree/calculator/per_item.rb |