Class: Clearance::Configuration
- Inherits:
-
Object
- Object
- Clearance::Configuration
- Defined in:
- lib/clearance/configuration.rb
Instance Attribute Summary collapse
-
#allow_sign_up ⇒ Object
writeonly
Sets the attribute allow_sign_up.
-
#cookie_domain ⇒ Object
Returns the value of attribute cookie_domain.
-
#cookie_expiration ⇒ Object
Returns the value of attribute cookie_expiration.
-
#cookie_path ⇒ Object
Returns the value of attribute cookie_path.
-
#httponly ⇒ Object
Returns the value of attribute httponly.
-
#mailer_sender ⇒ Object
Returns the value of attribute mailer_sender.
-
#password_strategy ⇒ Object
Returns the value of attribute password_strategy.
-
#redirect_url ⇒ Object
Returns the value of attribute redirect_url.
-
#secure_cookie ⇒ Object
Returns the value of attribute secure_cookie.
-
#sign_in_guards ⇒ Object
Returns the value of attribute sign_in_guards.
-
#user_model ⇒ Object
Returns the value of attribute user_model.
Instance Method Summary collapse
- #allow_sign_up? ⇒ Boolean
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #user_actions ⇒ Object
- #user_id_parameter ⇒ Object
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
17 18 19 20 21 22 23 24 25 26 |
# File 'lib/clearance/configuration.rb', line 17 def initialize @allow_sign_up = true @cookie_expiration = ->() { 1.year.from_now.utc } @cookie_path = '/' @httponly = false @mailer_sender = '[email protected]' @redirect_url = '/' @secure_cookie = false @sign_in_guards = [] end |
Instance Attribute Details
#allow_sign_up=(value) ⇒ Object (writeonly)
Sets the attribute allow_sign_up
3 4 5 |
# File 'lib/clearance/configuration.rb', line 3 def allow_sign_up=(value) @allow_sign_up = value end |
#cookie_domain ⇒ Object
Returns the value of attribute cookie_domain.
5 6 7 |
# File 'lib/clearance/configuration.rb', line 5 def @cookie_domain end |
#cookie_expiration ⇒ Object
Returns the value of attribute cookie_expiration.
5 6 7 |
# File 'lib/clearance/configuration.rb', line 5 def @cookie_expiration end |
#cookie_path ⇒ Object
Returns the value of attribute cookie_path.
5 6 7 |
# File 'lib/clearance/configuration.rb', line 5 def @cookie_path end |
#httponly ⇒ Object
Returns the value of attribute httponly.
5 6 7 |
# File 'lib/clearance/configuration.rb', line 5 def httponly @httponly end |
#mailer_sender ⇒ Object
Returns the value of attribute mailer_sender.
5 6 7 |
# File 'lib/clearance/configuration.rb', line 5 def mailer_sender @mailer_sender end |
#password_strategy ⇒ Object
Returns the value of attribute password_strategy.
5 6 7 |
# File 'lib/clearance/configuration.rb', line 5 def password_strategy @password_strategy end |
#redirect_url ⇒ Object
Returns the value of attribute redirect_url.
5 6 7 |
# File 'lib/clearance/configuration.rb', line 5 def redirect_url @redirect_url end |
#secure_cookie ⇒ Object
Returns the value of attribute secure_cookie.
5 6 7 |
# File 'lib/clearance/configuration.rb', line 5 def @secure_cookie end |
#sign_in_guards ⇒ Object
Returns the value of attribute sign_in_guards.
5 6 7 |
# File 'lib/clearance/configuration.rb', line 5 def sign_in_guards @sign_in_guards end |
#user_model ⇒ Object
Returns the value of attribute user_model.
5 6 7 |
# File 'lib/clearance/configuration.rb', line 5 def user_model @user_model end |
Instance Method Details
#allow_sign_up? ⇒ Boolean
32 33 34 |
# File 'lib/clearance/configuration.rb', line 32 def allow_sign_up? @allow_sign_up end |
#user_actions ⇒ Object
36 37 38 39 40 41 42 |
# File 'lib/clearance/configuration.rb', line 36 def user_actions if allow_sign_up? [:create] else [] end end |
#user_id_parameter ⇒ Object
44 45 46 |
# File 'lib/clearance/configuration.rb', line 44 def user_id_parameter "#{user_model.model_name.singular}_id".to_sym end |