Class: Auth::Behavior::Base::Configuration
- Inherits:
-
Object
- Object
- Auth::Behavior::Base::Configuration
- Includes:
- Configuration::Keys
- Defined in:
- lib/auth/behavior/base/configuration.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#configuration ⇒ Object
readonly
Provides a handle back to the root configuration object.
Class Method Summary collapse
Instance Method Summary collapse
- #configuration_name ⇒ Object
- #defaults! ⇒ Object (also: #reset!)
-
#enabled? ⇒ Boolean
Returns true if the root configuration object’s behaviors include :remember_me.
-
#initialize(configuration) ⇒ Configuration
constructor
A new instance of Configuration.
Methods included from Configuration::Keys
#configuration_keys, included, #to_hash
Constructor Details
#initialize(configuration) ⇒ Configuration
Returns a new instance of Configuration.
27 28 29 30 |
# File 'lib/auth/behavior/base/configuration.rb', line 27 def initialize(configuration) @configuration = configuration defaults! end |
Instance Attribute Details
#configuration ⇒ Object (readonly)
Provides a handle back to the root configuration object.
3 4 5 |
# File 'lib/auth/behavior/base/configuration.rb', line 3 def configuration @configuration end |
Class Method Details
.configuration_name(new_name = nil) ⇒ Object
8 9 10 11 12 13 14 15 |
# File 'lib/auth/behavior/base/configuration.rb', line 8 def configuration_name(new_name = nil) if new_name @configuration_name = new_name.to_sym else # the sub removes Configuration, ie Auth::Behavior::Core::Configuration becomes Auth::Behavior::Core @configuration_name = name.sub(/\:\:[^\:]*$/, '').demodulize.underscore.to_sym end end |
Instance Method Details
#configuration_name ⇒ Object
23 24 25 |
# File 'lib/auth/behavior/base/configuration.rb', line 23 def configuration_name self.class.configuration_name end |
#defaults! ⇒ Object Also known as: reset!
32 33 34 |
# File 'lib/auth/behavior/base/configuration.rb', line 32 def defaults! raise "Don't forget to override #{self.class.name}#defaults!" end |
#enabled? ⇒ Boolean
Returns true if the root configuration object’s behaviors include :remember_me.
19 20 21 |
# File 'lib/auth/behavior/base/configuration.rb', line 19 def enabled? configuration.behaviors.include? configuration_name end |