Sha256: 7be1528b3595ff59eb24c1fb500728bee8f29b8400591396067da481f8bdd8f6

Contents?: true

Size: 1.31 KB

Versions: 13

Compression:

Stored size: 1.31 KB

Contents

module CurationConcerns
  module Workflow
    # Responsible for creating database entries for the given workflow's actions
    class SipityActionsGenerator
      # @api public
      #
      # Responsible for creating database entries for the given workflow's actions
      #
      # @param workflow [Sipity::Workflow]
      # @param actions_configuration [Hash] as defined in CurationConcerns::Workflow::WorkflowSchema
      # @return [Sipity::Workflow]
      def self.call(**keywords, &block)
        new(**keywords, &block).call
      end

      def initialize(workflow:, actions_configuration:)
        self.workflow = workflow
        self.actions_configuration = actions_configuration
      end

      private

        attr_accessor :workflow

        attr_reader :actions_configuration

        def actions_configuration=(input)
          @actions_configuration = Array.wrap(input)
        end

      public

      def call
        generate_state_diagram!
        workflow
      end

      private

        def generate_state_diagram!
          actions_configuration.each do |configuration|
            Array.wrap(configuration.fetch(:name)).each do |name|
              StateMachineGenerator.generate_from_schema(workflow: workflow, name: name, **configuration.except(:name))
            end
          end
        end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
curation_concerns-1.7.8 app/services/curation_concerns/workflow/sipity_actions_generator.rb
curation_concerns-1.7.7 app/services/curation_concerns/workflow/sipity_actions_generator.rb
curation_concerns-2.0.0 app/services/curation_concerns/workflow/sipity_actions_generator.rb
curation_concerns-2.0.0.rc2 app/services/curation_concerns/workflow/sipity_actions_generator.rb
curation_concerns-1.7.6 app/services/curation_concerns/workflow/sipity_actions_generator.rb
curation_concerns-1.7.5 app/services/curation_concerns/workflow/sipity_actions_generator.rb
curation_concerns-1.7.4 app/services/curation_concerns/workflow/sipity_actions_generator.rb
curation_concerns-1.7.3 app/services/curation_concerns/workflow/sipity_actions_generator.rb
curation_concerns-1.7.2 app/services/curation_concerns/workflow/sipity_actions_generator.rb
curation_concerns-2.0.0.rc1 app/services/curation_concerns/workflow/sipity_actions_generator.rb
curation_concerns-1.7.1 app/services/curation_concerns/workflow/sipity_actions_generator.rb
curation_concerns-1.7.0 app/services/curation_concerns/workflow/sipity_actions_generator.rb
curation_concerns-1.7.0.beta1 app/services/curation_concerns/workflow/sipity_actions_generator.rb