Class: Clearance::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/clearance/configuration.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

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 = ->(cookies) { 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

Parameters:

  • value

    the value to set the attribute allow_sign_up to.



3
4
5
# File 'lib/clearance/configuration.rb', line 3

def allow_sign_up=(value)
  @allow_sign_up = value
end

Returns the value of attribute cookie_domain.



5
6
7
# File 'lib/clearance/configuration.rb', line 5

def cookie_domain
  @cookie_domain
end

Returns the value of attribute cookie_expiration.



5
6
7
# File 'lib/clearance/configuration.rb', line 5

def cookie_expiration
  @cookie_expiration
end

Returns the value of attribute cookie_path.



5
6
7
# File 'lib/clearance/configuration.rb', line 5

def cookie_path
  @cookie_path
end

#httponlyObject

Returns the value of attribute httponly.



5
6
7
# File 'lib/clearance/configuration.rb', line 5

def httponly
  @httponly
end

#mailer_senderObject

Returns the value of attribute mailer_sender.



5
6
7
# File 'lib/clearance/configuration.rb', line 5

def mailer_sender
  @mailer_sender
end

#password_strategyObject

Returns the value of attribute password_strategy.



5
6
7
# File 'lib/clearance/configuration.rb', line 5

def password_strategy
  @password_strategy
end

#redirect_urlObject

Returns the value of attribute redirect_url.



5
6
7
# File 'lib/clearance/configuration.rb', line 5

def redirect_url
  @redirect_url
end

Returns the value of attribute secure_cookie.



5
6
7
# File 'lib/clearance/configuration.rb', line 5

def secure_cookie
  @secure_cookie
end

#sign_in_guardsObject

Returns the value of attribute sign_in_guards.



5
6
7
# File 'lib/clearance/configuration.rb', line 5

def 
  @sign_in_guards
end

#user_modelObject

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

Returns:

  • (Boolean)


32
33
34
# File 'lib/clearance/configuration.rb', line 32

def allow_sign_up?
  @allow_sign_up
end

#user_actionsObject



36
37
38
39
40
41
42
# File 'lib/clearance/configuration.rb', line 36

def  
  if allow_sign_up?
    [:create]
  else
    []
  end
end

#user_id_parameterObject



44
45
46
# File 'lib/clearance/configuration.rb', line 44

def user_id_parameter
  "#{user_model.model_name.singular}_id".to_sym
end