| Module | OmniAuth::Strategy::ClassMethods |
| In: |
lib/omniauth/strategy.rb
|
Sets (and retrieves) option key names for initializer arguments to be recorded as. This takes care of 90% of the use cases for overriding the initializer in OmniAuth Strategies.
This allows for more declarative subclassing of strategies by allowing default options to be set using a simple configure call.
@param options [Hash] If supplied, these will be the default options (deep-merged into the superclass‘s default options). @yield [Options] The options Mash that allows you to set your defaults as you‘d like.
@example Using a yield to configure the default options.
class MyStrategy
include OmniAuth::Strategy
configure do |c|
c.foo = 'bar'
end
end
@example Using a hash to configure the default options.
class MyStrategy
include OmniAuth::Strategy
configure foo: 'bar'
end
Directly declare a default option for your class. This is a useful from a documentation perspective as it provides a simple line-by-line analysis of the kinds of options your strategy provides by default.
@param name [Symbol] The key of the default option in your configuration hash. @param value [Object] The value your object defaults to. Nil if not provided.
@example
class MyStrategy
include OmniAuth::Strategy
option :foo, 'bar'
option
end