Sha256: 48aac9c718229ff22cb6b0821a24cfaaafdd0301e8da9c64a14bca8999ae7fdf

Contents?: true

Size: 593 Bytes

Versions: 5

Compression:

Stored size: 593 Bytes

Contents

# frozen_string_literal: true

require_relative 'expansion'

module Gitlab
  module Triage
    module ExpandCondition
      module Sequence
        PATTERN = /\{\s*(\d+)\s*\.\.\s*(\d+)\s*\}/

        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
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
gitlab-triage-1.44.1 lib/gitlab/triage/expand_condition/sequence.rb
gitlab-triage-1.44.0 lib/gitlab/triage/expand_condition/sequence.rb
gitlab-triage-1.43.2 lib/gitlab/triage/expand_condition/sequence.rb
gitlab-triage-1.43.1 lib/gitlab/triage/expand_condition/sequence.rb
gitlab-triage-1.43.0 lib/gitlab/triage/expand_condition/sequence.rb