Class: Gitlab::Triage::APIQueryBuilders::MultiQueryParamBuilder
- Inherits:
-
BaseQueryParamBuilder
- Object
- BaseQueryParamBuilder
- Gitlab::Triage::APIQueryBuilders::MultiQueryParamBuilder
- Defined in:
- lib/gitlab/triage/api_query_builders/multi_query_param_builder.rb
Instance Attribute Summary collapse
-
#separator ⇒ Object
readonly
Returns the value of attribute separator.
Attributes inherited from BaseQueryParamBuilder
#allowed_values, #param_contents, #param_name
Instance Method Summary collapse
-
#initialize(param_name, param_contents, separator, allowed_values: nil) ⇒ MultiQueryParamBuilder
constructor
A new instance of MultiQueryParamBuilder.
- #param_content ⇒ Object
- #validate_allowed_values! ⇒ Object private
Methods inherited from BaseQueryParamBuilder
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
#separator ⇒ Object (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_content ⇒ Object
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 |