Sha256: e0746aba92d040e95a78b9d31a48f4f94251a90995900cb3fdd7a9774734cced

Contents?: true

Size: 583 Bytes

Versions: 6

Compression:

Stored size: 583 Bytes

Contents

# frozen_string_literal: true

module Floe
  class Workflow
    module States
      module NonTerminalMixin
        def finish(context)
          # If this state is failed or this is an end state, next_state to nil
          context.next_state ||= end? || context.failed? ? nil : @next

          super
        end

        def validate_state_next!(workflow)
          missing_field_error!("Next") if @next.nil? && !@end
          invalid_field_error!("Next", @next, "is not found in \"States\"") if @next && !workflow_state?(@next, workflow)
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
floe-0.15.1 lib/floe/workflow/states/non_terminal_mixin.rb
floe-0.15.0 lib/floe/workflow/states/non_terminal_mixin.rb
floe-0.14.0 lib/floe/workflow/states/non_terminal_mixin.rb
floe-0.13.1 lib/floe/workflow/states/non_terminal_mixin.rb
floe-0.13.0 lib/floe/workflow/states/non_terminal_mixin.rb
floe-0.12.0 lib/floe/workflow/states/non_terminal_mixin.rb