Class: Gitlab::Triage::APIQueryBuilders::MultiQueryParamBuilder

Inherits:
BaseQueryParamBuilder show all
Defined in:
lib/gitlab/triage/api_query_builders/multi_query_param_builder.rb

Instance Attribute Summary collapse

Attributes inherited from BaseQueryParamBuilder

#allowed_values, #param_contents, #param_name

Instance Method Summary collapse

Methods inherited from BaseQueryParamBuilder

#build_param

Constructor Details

#initialize(param_name, param_contents, separator, allowed_values: nil) ⇒ MultiQueryParamBuilder

Returns a new instance of MultiQueryParamBuilder.



11
12
13
14
# File 'lib/gitlab/triage/api_query_builders/multi_query_param_builder.rb', line 11

def initialize(param_name, param_contents, separator, allowed_values: nil)
  @separator = separator
  super(param_name, Array(param_contents), allowed_values: allowed_values)
end

Instance Attribute Details

#separatorObject (readonly)

Returns the value of attribute separator.



9
10
11
# File 'lib/gitlab/triage/api_query_builders/multi_query_param_builder.rb', line 9

def separator
  @separator
end

Instance Method Details

#param_contentObject



16
17
18
# File 'lib/gitlab/triage/api_query_builders/multi_query_param_builder.rb', line 16

def param_content
  param_contents.map(&:strip).join(separator)
end

#validate_allowed_values!Object (private)



22
23
24
25
26
# File 'lib/gitlab/triage/api_query_builders/multi_query_param_builder.rb', line 22

def validate_allowed_values!
  param_contents.each do |param|
    ParamsValidator.new([{ name: param_name, type: String, values: allowed_values }], { param_name => param }).validate!
  end
end