module OmniAuth::Strategy::ClassMethods
def args(args = nil)
recorded as. This takes care of 90% of the use cases for overriding
Sets (and retrieves) option key names for initializer arguments to be
def args(args = nil) if args @args = Array(args) return end existing = superclass.respond_to?(:args) ? superclass.args : [] (instance_variable_defined?(:@args) && @args) || existing end
def compile_stack(ancestors, method, context)
def compile_stack(ancestors, method, context) stack = ancestors.inject([]) do |a, ancestor| a << context.instance_eval(&ancestor.send(method)) if ancestor.respond_to?(method) && ancestor.send(method) a end stack.reverse! end
def configure(options = nil)
- Example: Using a hash to configure the default options. -
Example: Using a yield to configure the default options. -
Other tags:
- Yield: - The options Mash that allows you to set your defaults as you'd like.
Parameters:
-
options(Hash) -- If supplied, these will be the default options (deep-merged into the superclass's default options).
def configure(options = nil) if block_given? yield default_options else default_options.deep_merge!(options) end end
def default_options
Returns an inherited set of default options set at the class-level
def default_options # existing = superclass.default_options if superclass.respond_to?(:default_options) existing = superclass.respond_to?(:default_options) ? superclass.default_options : {} @default_options ||= OmniAuth::Strategy::Options.new(existing) end
def option(name, value = nil)
-
value(Object) -- The value your object defaults to. Nil if not provided. -
name(Symbol) -- The key of the default option in your configuration hash.
def option(name, value = nil) default_options[name] = value end