Sha256: 264326d352f91d92648dc63a062c76b9943d5f66b8132e160ab0a5c8c772ef28

Contents?: true

Size: 769 Bytes

Versions: 5

Compression:

Stored size: 769 Bytes

Contents

# frozen_string_literal: true

require_relative '../../utils'
require_relative 'base_param_builder'

module Gitlab
  module Triage
    module GraphqlQueries
      module QueryParamBuilders
        class ArrayParamBuilder < BaseParamBuilder
          def initialize(param_name, values, with_quotes: true, negated: false)
            quoted_values = values.map do |value|
              if with_quotes
                Utils.graphql_quote(value)
              else
                value
              end
            end

            array_param_content =
              quoted_values.join(', ').then { |content| "[#{content}]" }

            super(param_name, array_param_content, with_quotes: false, negated: negated)
          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/graphql_queries/query_param_builders/array_param_builder.rb
gitlab-triage-1.44.0 lib/gitlab/triage/graphql_queries/query_param_builders/array_param_builder.rb
gitlab-triage-1.43.2 lib/gitlab/triage/graphql_queries/query_param_builders/array_param_builder.rb
gitlab-triage-1.43.1 lib/gitlab/triage/graphql_queries/query_param_builders/array_param_builder.rb
gitlab-triage-1.43.0 lib/gitlab/triage/graphql_queries/query_param_builders/array_param_builder.rb