Module: Card::ActManager::StageDirector::Phases

Included in:
Card::ActManager::StageDirector
Defined in:
lib/card/act_manager/stage_director/phases.rb

Instance Method Summary collapse

Instance Method Details

#integration_phaseObject



26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/card/act_manager/stage_director/phases.rb', line 26

def integration_phase
  return if @abort

  @card.restore_changes_information
  run_single_stage :integrate
  run_single_stage :after_integrate
  run_single_stage :integrate_with_delay
rescue StandardError => e # don't rollback
  Card::Error.report e, @card
  false
ensure
  @card.clear_changes_information unless @abort
  # ActManager.clear if main? && [email protected]_storage_phase
end

#storage_phase(&block) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/card/act_manager/stage_director/phases.rb', line 13

def storage_phase &block
  catch_up_to_stage :prepare_to_store
  run_single_stage :store, &block
  run_single_stage :finalize
  if @card.errors.any?
    @card.expire_pieces
    raise ActiveRecord::Rollback,
          "errors added in storage phase: #{@card.errors.full_messages * ','}"
  end
ensure
  @from_trash = nil
end

#validation_phaseObject



5
6
7
8
9
10
11
# File 'lib/card/act_manager/stage_director/phases.rb', line 5

def validation_phase
  run_single_stage :initialize
  run_single_stage :prepare_to_validate
  run_single_stage :validate
  @card.expire_pieces if @card.errors.any?
  @card.errors.empty?
end