Class: Pakyow::Application::Connection::Session::Cookie
- Inherits:
-
Base
- Object
- Support::IndifferentHash
- Base
- Pakyow::Application::Connection::Session::Cookie
- Defined in:
- lib/pakyow/application/connection/session/cookie.rb
Instance Method Summary collapse
-
#initialize(connection, options) ⇒ Cookie
constructor
A new instance of Cookie.
- #to_s ⇒ Object
Methods inherited from Base
Constructor Details
#initialize(connection, options) ⇒ Cookie
Returns a new instance of Cookie.
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/pakyow/application/connection/session/cookie.rb', line 15 def initialize(connection, ) if ( = connection.[.name]) && .is_a?(Support::IndifferentHash) super(connection, , Support::IndifferentHash.new([:value].to_h)) connection.[.name][:value] = self else super(connection, , deserialize(connection, )) connection.[.name] = Support::IndifferentHash.new( domain: .domain, path: .path, max_age: .max_age, expires: .expires, secure: .secure, http_only: .http_only, same_site: .same_site, value: self ) # Update the original cookie value so we can compare for changes. # connection.(.name, self.dup) end end |
Instance Method Details
#to_s ⇒ Object
38 39 40 41 42 43 44 |
# File 'lib/pakyow/application/connection/session/cookie.rb', line 38 def to_s Base64.urlsafe_encode64( Pakyow.verifier.sign( Marshal.dump(to_h) ) ) end |