Class: Devise::PathChecker

Inherits:
Object
  • Object
show all
Defined in:
lib/devise_session_limit/path_checker.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(env, scope) ⇒ PathChecker

Returns a new instance of PathChecker.



13
14
15
16
# File 'lib/devise_session_limit/path_checker.rb', line 13

def initialize(env, scope)
  @current_path = "/#{env["SCRIPT_NAME"]}/#{env["PATH_INFO"]}".squeeze("/")
  @scope = scope
end

Class Method Details

.default_url_options(*args) ⇒ Object



5
6
7
8
9
10
11
# File 'lib/devise_session_limit/path_checker.rb', line 5

def self.default_url_options(*args)
  if defined?(ApplicationController)
    ApplicationController.default_url_options(*args)
  else
    {}
  end
end

Instance Method Details

#signing_out?Boolean

Returns:

  • (Boolean)


18
19
20
21
# File 'lib/devise_session_limit/path_checker.rb', line 18

def signing_out?
  route = "destroy_#{@scope}_session_path"
  respond_to?(route) && @current_path == send(route)
end