Module: Gitlab::Triage::ExpandCondition::List

Defined in:
lib/gitlab/triage/expand_condition/list.rb

Constant Summary collapse

PATTERN =
/\{.+?,.+?\}/m

Class Method Summary collapse

Class Method Details

.expand(conditions) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/gitlab/triage/expand_condition/list.rb', line 11

def self.expand(conditions)
  labels = conditions[:labels]

  return conditions unless labels

  expansion = Expansion.new(PATTERN) do |list|
    list.gsub(/\{|\}/, '').split(',').map(&:strip)
  end

  expansion.perform(labels).map do |new_labels|
    conditions.merge(labels: new_labels)
  end
end