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



17
18
19
20
# File 'app/models/spree/reimbursement/reimbursement_type_engine.rb', line 17

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

Instance Method Details

#calculate_reimbursement_typesObject



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

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