Module: Gitlab::Triage::ExpandCondition::Sequence

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

Constant Summary collapse

PATTERN =
/\{\s*(\d+)\s*\.\.\s*(\d+)\s*\}/

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/sequence.rb', line 11

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

  return conditions unless labels

  expansion = Expansion.new(PATTERN) do |(lower, upper)|
    Integer(lower)..Integer(upper)
  end

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