Class: Spree::Reimbursement::ReimbursementTypeEngine

Inherits:
Object
  • Object
show all
Includes:
ReimbursementTypeValidator
Defined in:
app/models/spree/reimbursement/reimbursement_type_engine.rb

Instance Method Summary collapse

Methods included from ReimbursementTypeValidator

#past_reimbursable_time_period?, #valid_preferred_reimbursement_type?

Constructor Details

#initialize(return_items) ⇒ ReimbursementTypeEngine

Returns a new instance of ReimbursementTypeEngine.



19
20
21
22
# File 'app/models/spree/reimbursement/reimbursement_type_engine.rb', line 19

def initialize(return_items)
  @return_items = return_items
  @reimbursement_type_hash = Hash.new { |hash, key| hash[key] = [] }
end

Instance Method Details

#calculate_reimbursement_typesObject



24
25
26
27
28
29
30
31
# File 'app/models/spree/reimbursement/reimbursement_type_engine.rb', line 24

def calculate_reimbursement_types
  @return_items.each do |return_item|
    reimbursement_type = calculate_reimbursement_type(return_item)
    add_reimbursement_type(return_item, reimbursement_type)
  end

  @reimbursement_type_hash
end