class JSONAPI::ConfigManager::Config
User configurations for the gem
Constants
- READER_METHODS
Attributes
allow_client_ids[R]
required_document_members[R]
required_headers[R]
required_query_params[R]
Public Class Methods
new()
click to toggle source
# File lib/easy/jsonapi/config_manager/config.rb, line 12 def initialize @allow_client_ids = false @default = true end
Public Instance Methods
default?()
click to toggle source
Performancewise, configs are all initialized as a startup cost, to change them you need to
restart the server. As a result of this, the #default? is used to process a request faster if user-defined configs do not need to be checked when screening http requests. Because @default is set to false upon config assignment (see #method missing in Config), this allows the a user to potentially make the middleware screening less performant than necessary by assigning config values to the default values, or assigning values to something not default, and then assigning config values to the default again. If used as intended, however, this should make the middleware screening faster.
@return [TrueClass | FalseClass]
# File lib/easy/jsonapi/config_manager/config.rb, line 26 def default? @default end
Private Instance Methods
method_missing(method_name, *args, &block)
click to toggle source
Only used if implementing Item
directly.
dynamically creates accessor methods for instance variables created in the initialize
Calls superclass method
# File lib/easy/jsonapi/config_manager/config.rb, line 37 def method_missing(method_name, *args, &block) super unless READER_METHODS.include?(method_name.to_s[0..-2].to_sym) instance_variable_set("@#{method_name}"[0..-2].to_sym, args[0]) @default = false end
respond_to_missing?(method_name, *args)
click to toggle source
Needed when using method_missing
Calls superclass method
# File lib/easy/jsonapi/config_manager/config.rb, line 44 def respond_to_missing?(method_name, *args) methods.include?(method_name) || super end