Class: Gitlab::Triage::GraphqlQueries::QueryParamBuilders::ArrayParamBuilder

Inherits:
BaseParamBuilder
  • Object
show all
Defined in:
lib/gitlab/triage/graphql_queries/query_param_builders/array_param_builder.rb

Instance Attribute Summary

Attributes inherited from BaseParamBuilder

#negated, #param_contents, #param_name, #with_quotes

Instance Method Summary collapse

Methods inherited from BaseParamBuilder

#build_param

Constructor Details

#initialize(param_name, values, with_quotes: true, negated: false) ⇒ ArrayParamBuilder

Returns a new instance of ArrayParamBuilder.



11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/gitlab/triage/graphql_queries/query_param_builders/array_param_builder.rb', line 11

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