class JSONAPI::Request::QueryParamCollection::QueryParam
A generic name=value query parameter
Public Class Methods
new(name, value)
click to toggle source
@param name [String] The name of the parameter @param value [String | Array<String>] The value of the parameter
Calls superclass method
JSONAPI::NameValuePair::new
# File lib/easy/jsonapi/request/query_param_collection/query_param.rb, line 17 def initialize(name, value) if instance_of?(QueryParam) JSONAPI::Exceptions::QueryParamsExceptions.check_param_name(name) end value = value.split(',') if value.is_a? String super(name, value) end
Public Instance Methods
name=(_)
click to toggle source
@raise RuntimeError Cannot change the name of a QueryParam
object
# File lib/easy/jsonapi/request/query_param_collection/query_param.rb, line 38 def name=(_) raise 'Cannot change the name of QueryParam Objects' end
to_s()
click to toggle source
Represents a parameter as a string
# File lib/easy/jsonapi/request/query_param_collection/query_param.rb, line 33 def to_s "#{name}=#{JSONAPI::Utility.to_string_collection(value, delimiter: ',')}" end
value=(new_value)
click to toggle source
Update the query_param value, turning value into an array if it was given as a string @param new_value [String, Array<String>] The new value of the Parameter
Calls superclass method
JSONAPI::NameValuePair#value=
# File lib/easy/jsonapi/request/query_param_collection/query_param.rb, line 27 def value=(new_value) new_value = new_value.split(',') if new_value.is_a? String super(new_value) end