Class: Authlogic::CookieCredentials Private
- Inherits:
-
Object
- Object
- Authlogic::CookieCredentials
- Defined in:
- lib/authlogic/cookie_credentials.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Represents the credentials in the cookie. The value of the cookie. This is primarily a data object. It doesn’t interact with controllers. It doesn’t know about eg. cookie expiration.
Defined Under Namespace
Classes: ParseError
Constant Summary collapse
- DELIMITER =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
"::"
Instance Attribute Summary collapse
- #persistence_token ⇒ Object readonly private
- #record_id ⇒ Object readonly private
- #remember_me_until ⇒ Object readonly private
Class Method Summary collapse
- .parse(string) ⇒ Object private
Instance Method Summary collapse
-
#initialize(persistence_token, record_id, remember_me_until) ⇒ CookieCredentials
constructor
private
A new instance of CookieCredentials.
- #remember_me? ⇒ Boolean private
- #to_s ⇒ Object private
Constructor Details
#initialize(persistence_token, record_id, remember_me_until) ⇒ CookieCredentials
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of CookieCredentials.
22 23 24 25 26 |
# File 'lib/authlogic/cookie_credentials.rb', line 22 def initialize(persistence_token, record_id, remember_me_until) @persistence_token = persistence_token @record_id = record_id @remember_me_until = remember_me_until end |
Instance Attribute Details
#persistence_token ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
16 17 18 |
# File 'lib/authlogic/cookie_credentials.rb', line 16 def persistence_token @persistence_token end |
#record_id ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
16 17 18 |
# File 'lib/authlogic/cookie_credentials.rb', line 16 def record_id @record_id end |
#remember_me_until ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
16 17 18 |
# File 'lib/authlogic/cookie_credentials.rb', line 16 def remember_me_until @remember_me_until end |
Class Method Details
.parse(string) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
30 31 32 33 34 35 36 |
# File 'lib/authlogic/cookie_credentials.rb', line 30 def parse(string) parts = string.split(DELIMITER) unless (1..3).cover?(parts.length) raise ParseError, format("Expected 1..3 parts, got %d", parts.length) end new(parts[0], parts[1], parse_time(parts[2])) end |
Instance Method Details
#remember_me? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
50 51 52 |
# File 'lib/authlogic/cookie_credentials.rb', line 50 def remember_me? !@remember_me_until.nil? end |
#to_s ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
55 56 57 58 59 60 61 |
# File 'lib/authlogic/cookie_credentials.rb', line 55 def to_s [ @persistence_token, @record_id.to_s, @remember_me_until&.iso8601 ].compact.join(DELIMITER) end |