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

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

Constant Summary collapse

PATTERN =
/\{\s*(\d+)\s*\.\.\s*(\d+)\s*\}/.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/sequence.rb', line 9

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