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.



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

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.



7
8
9
# File 'lib/gitlab/triage/api_query_builders/multi_query_param_builder.rb', line 7

def separator
  @separator
end

Instance Method Details

#param_contentObject



14
15
16
# File 'lib/gitlab/triage/api_query_builders/multi_query_param_builder.rb', line 14

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

#validate_allowed_values!Object (private)



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

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