Module: Authlogic::ActsAsAuthentic::LoggedInStatus::Methods::InstanceMethods

Defined in:
lib/authlogic/acts_as_authentic/logged_in_status.rb

Overview

:nodoc:

Instance Method Summary collapse

Instance Method Details

#logged_in?Boolean

Returns true if the last_request_at > logged_in_timeout.

Returns:

  • (Boolean)


61
62
63
64
65
66
67
68
69
# File 'lib/authlogic/acts_as_authentic/logged_in_status.rb', line 61

def logged_in?
  unless respond_to?(:last_request_at)
    raise(
      "Can not determine the records login state because " \
        "there is no last_request_at column"
    )
  end
  !last_request_at.nil? && last_request_at > logged_in_timeout.seconds.ago
end

#logged_out?Boolean

Opposite of logged_in?

Returns:

  • (Boolean)


72
73
74
# File 'lib/authlogic/acts_as_authentic/logged_in_status.rb', line 72

def logged_out?
  !logged_in?
end