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

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

Constant Summary collapse

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

Class Method Summary collapse

Class Method Details

.expand(conditions) ⇒ Object



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

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