Sha256: 98a2738087bf91674d0614c4a731c02a3f78f486dc4fa5bd62758653e12a337b

Contents?: true

Size: 856 Bytes

Versions: 23

Compression:

Stored size: 856 Bytes

Contents

# frozen_string_literal: true

module Gitlab
  module Triage
    module Policies
      class BasePolicy
        attr_reader :type, :policy_spec, :resources, :network

        def initialize(type, policy_spec, resources, network)
          @type = type
          @policy_spec = policy_spec
          @resources = resources
          @network = network
        end

        def name
          @name ||= (policy_spec[:name] || "#{type}-#{object_id}")
        end

        def actions
          @actions ||= policy_spec.fetch(:actions) { {} }
        end

        def summarize?
          actions.key?(:summarize)
        end

        def comment?
          # The actual keys are strings
          (actions.keys.map(&:to_sym) - [:summarize]).any?
        end

        def build_issue
          raise NotImplementedError
        end
      end
    end
  end
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
gitlab-triage-1.14.3 lib/gitlab/triage/policies/base_policy.rb
gitlab-triage-1.14.2 lib/gitlab/triage/policies/base_policy.rb
gitlab-triage-1.14.1 lib/gitlab/triage/policies/base_policy.rb
gitlab-triage-1.14.0 lib/gitlab/triage/policies/base_policy.rb
gitlab-triage-1.13.0 lib/gitlab/triage/policies/base_policy.rb
gitlab-triage-1.12.0 lib/gitlab/triage/policies/base_policy.rb
gitlab-triage-1.11.0 lib/gitlab/triage/policies/base_policy.rb
gitlab-triage-1.10.1 lib/gitlab/triage/policies/base_policy.rb
gitlab-triage-1.10.0 lib/gitlab/triage/policies/base_policy.rb
gitlab-triage-1.9.0 lib/gitlab/triage/policies/base_policy.rb
gitlab-triage-1.8.0 lib/gitlab/triage/policies/base_policy.rb
gitlab-triage-1.7.1 lib/gitlab/triage/policies/base_policy.rb
gitlab-triage-1.7.0 lib/gitlab/triage/policies/base_policy.rb
gitlab-triage-1.6.1 lib/gitlab/triage/policies/base_policy.rb
gitlab-triage-1.6.0 lib/gitlab/triage/policies/base_policy.rb
gitlab-triage-1.5.1 lib/gitlab/triage/policies/base_policy.rb
gitlab-triage-1.5.0 lib/gitlab/triage/policies/base_policy.rb
gitlab-triage-1.4.2 lib/gitlab/triage/policies/base_policy.rb
gitlab-triage-1.4.1 lib/gitlab/triage/policies/base_policy.rb
gitlab-triage-1.4.0 lib/gitlab/triage/policies/base_policy.rb