Class: Gitlab::Triage::Filters::NoAdditionalLabelsConditionsFilter

Inherits:
BaseConditionsFilter show all
Defined in:
lib/gitlab/triage/filters/no_additional_labels_conditions_filter.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseConditionsFilter

all_params_filter_names, #initialize, params_check_for_field, params_checking_condition_type, params_checking_condition_value, params_filter_names

Constructor Details

This class inherits a constructor from Gitlab::Triage::Filters::BaseConditionsFilter

Class Method Details

.filter_parametersObject



7
8
9
# File 'lib/gitlab/triage/filters/no_additional_labels_conditions_filter.rb', line 7

def self.filter_parameters
  []
end

Instance Method Details

#calculateObject



24
25
26
# File 'lib/gitlab/triage/filters/no_additional_labels_conditions_filter.rb', line 24

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

#initialize_variables(expected_labels) ⇒ Object



15
16
17
18
# File 'lib/gitlab/triage/filters/no_additional_labels_conditions_filter.rb', line 15

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

#resource_valueObject



20
21
22
# File 'lib/gitlab/triage/filters/no_additional_labels_conditions_filter.rb', line 20

def resource_value
  @resource[@attribute]
end

#validate_condition(condition) ⇒ Object

Raises:

  • (ArgumentError)


11
12
13
# File 'lib/gitlab/triage/filters/no_additional_labels_conditions_filter.rb', line 11

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