Sha256: 3cfaee350ce9efa1dd28a076d8215827b560e292b04794f22fe26c521e151217

Contents?: true

Size: 882 Bytes

Versions: 5

Compression:

Stored size: 882 Bytes

Contents

# frozen_string_literal: true

require_relative 'action/summarize'
require_relative 'action/comment'
require_relative 'action/comment_on_summary'
require_relative 'action/issue'
require_relative 'action/delete'

module Gitlab
  module Triage
    module Action
      def self.process(policy:, **args)
        policy.validate!

        [
          [Summarize, policy.summarize?],
          [Comment, policy.comment?],
          [CommentOnSummary, policy.comment_on_summary?],
          [Issue, policy.issue?],
          [Delete, policy.delete?]
        ].each do |action, active|
          act(action: action, policy: policy, **args) if active
        end
      end

      def self.act(action:, dry:, **args)
        klass =
          if dry
            action.const_get(:Dry)
          else
            action
          end

        klass.new(**args).act
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
gitlab-triage-1.44.1 lib/gitlab/triage/action.rb
gitlab-triage-1.44.0 lib/gitlab/triage/action.rb
gitlab-triage-1.43.2 lib/gitlab/triage/action.rb
gitlab-triage-1.43.1 lib/gitlab/triage/action.rb
gitlab-triage-1.43.0 lib/gitlab/triage/action.rb