Class: Spree::Calculator::PercentOnLineItem

Inherits:
Spree::Calculator show all
Defined in:
app/models/spree/calculator/percent_on_line_item.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Spree::Calculator

#available?, calculators, #description, register, #to_s

Class Method Details

.descriptionObject


6
7
8
# File 'app/models/spree/calculator/percent_on_line_item.rb', line 6

def self.description
  Spree.t(:percent_per_item)
end

Instance Method Details

#compute(object) ⇒ Object


10
11
12
# File 'app/models/spree/calculator/percent_on_line_item.rb', line 10

def compute(object)
  ((object.price * object.quantity) * preferred_percent) / 100
end