Sha256: b7f29ded62aa2577d7710c2f4561b40bc8ecb9a9cd1a8aef61022b9acf0c6463

Contents?: true

Size: 740 Bytes

Versions: 2

Compression:

Stored size: 740 Bytes

Contents

require_relative 'base_conditions_limiter'

module Gitlab
  module Triage
    module Limiters
      class NoAdditionalLabelsConditionsLimiter < BaseConditionsLimiter
        def self.limiter_parameters
          []
        end

        def validate_condition(condition)
          raise ArgumentError, 'condition must be an array containing the only label values allowed' unless condition.is_a?(Array)
        end

        def initialize_variables(expected_labels)
          @attribute = :labels
          @expected_labels = expected_labels
        end

        def resource_value
          @resource[@attribute]
        end

        def calculate
          (resource_value - @expected_labels).empty?
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
gitlab-triage-0.6.0 lib/gitlab/triage/limiters/no_additional_labels_conditions_limiter.rb
gitlab-triage-0.5.0 lib/gitlab/triage/limiters/no_additional_labels_conditions_limiter.rb