Sha256: 00a0f785cc8fda2786e25d65a47c788f1012ff82cc2a005a1788f538ae59f2f3

Contents?: true

Size: 725 Bytes

Versions: 10

Compression:

Stored size: 725 Bytes

Contents

module Pageflow
  module ProcessedFileStateMachine
    extend ActiveSupport::Concern

    included do
      processing_state_machine do
        extend StateMachineJob::Macro

        state 'processing'
        state 'processed'
        state 'processing_failed'

        event :process do
          transition 'uploaded' => 'processing'
          transition 'processing_failed' => 'processing'
        end

        job ProcessFileJob do
          on_enter 'processing'
          result :ok => 'processed'
          result :error => 'processing_failed'
        end
      end
    end

    def retry!
      process!
    end

    def retryable?
      processing_failed?
    end

    def ready?
      processed?
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
pageflow-14.2.1 app/state_machines/pageflow/processed_file_state_machine.rb
pageflow-14.2.0 app/state_machines/pageflow/processed_file_state_machine.rb
pageflow-14.1.1 app/state_machines/pageflow/processed_file_state_machine.rb
pageflow-14.1.0 app/state_machines/pageflow/processed_file_state_machine.rb
pageflow-14.0.0 app/state_machines/pageflow/processed_file_state_machine.rb
pageflow-14.0.0.rc2 app/state_machines/pageflow/processed_file_state_machine.rb
pageflow-14.0.0.rc1 app/state_machines/pageflow/processed_file_state_machine.rb
pageflow-14.0.0.beta3 app/state_machines/pageflow/processed_file_state_machine.rb
pageflow-14.0.0.beta2 app/state_machines/pageflow/processed_file_state_machine.rb
pageflow-14.0.0.beta1 app/state_machines/pageflow/processed_file_state_machine.rb