class JSONAPI::Request::QueryParamCollection
A collection of QueryParam
objects
Constants
- SPECIAL_QUERY_PARAMS
The special query params defined by the JSON:API specification
Public Class Methods
new(param_arr = [])
click to toggle source
@param param_arr [Array<JSONAPI::Request::QueryParamCollection::QueryParam] The
query params to initialize the collection with
Calls superclass method
JSONAPI::NameValuePairCollection::new
# File lib/easy/jsonapi/request/query_param_collection.rb, line 16 def initialize(param_arr = []) super(param_arr, item_type: JSONAPI::Request::QueryParamCollection::QueryParam) end
Public Instance Methods
add(param)
click to toggle source
Add a QueryParameter to the collection. (CASE-SENSITIVE) @param param [JSONAPI::Request::QueryParamCollection::QueryParam] The param to add
Calls superclass method
JSONAPI::NameValuePairCollection#add
# File lib/easy/jsonapi/request/query_param_collection.rb, line 25 def add(param) super(param, &:name) end
to_s()
click to toggle source
Represent query param collection like the query_param string
# File lib/easy/jsonapi/request/query_param_collection.rb, line 37 def to_s JSONAPI::Utility.to_string_collection(self, delimiter: '&') end
Private Instance Methods
method_missing(method_name, *args, &block)
click to toggle source
Gets the QueryParam
object whose name matches the method_name called @param method_name [Symbol] The name of the method called @param args If any arguments were passed to the method called @param block If a block was passed to the method called
Calls superclass method
JSONAPI::NameValuePairCollection#method_missing
# File lib/easy/jsonapi/request/query_param_collection.rb, line 47 def method_missing(method_name, *args, &block) included = include?(method_name) super unless included || SPECIAL_QUERY_PARAMS.include?(method_name) if included return get(method_name) end nil end
respond_to_missing?(method_name, *)
click to toggle source
Whether or not method missing should be called.
Calls superclass method
JSONAPI::NameValuePairCollection#respond_to_missing?
# File lib/easy/jsonapi/request/query_param_collection.rb, line 57 def respond_to_missing?(method_name, *) include?(method_name) || super end