Class: ActionDispatch::Cookies::PermanentCookieJar
- Defined in:
- lib/action_dispatch/middleware/cookies.rb
Overview
:nodoc:
Constant Summary
Constants inherited from CookieJar
Instance Method Summary collapse
- #[]=(key, options) ⇒ Object
-
#initialize(parent_jar, secret) ⇒ PermanentCookieJar
constructor
A new instance of PermanentCookieJar.
- #method_missing(method, *arguments, &block) ⇒ Object
- #signed ⇒ Object
Methods inherited from CookieJar
#[], build, #clear, #delete, #each, #handle_options, #key?, #permanent, #recycle!, #update, #write
Constructor Details
#initialize(parent_jar, secret) ⇒ PermanentCookieJar
Returns a new instance of PermanentCookieJar.
252 253 254 |
# File 'lib/action_dispatch/middleware/cookies.rb', line 252 def initialize(parent_jar, secret) @parent_jar, @secret = parent_jar, secret end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *arguments, &block) ⇒ Object
271 272 273 |
# File 'lib/action_dispatch/middleware/cookies.rb', line 271 def method_missing(method, *arguments, &block) @parent_jar.send(method, *arguments, &block) end |
Instance Method Details
#[]=(key, options) ⇒ Object
256 257 258 259 260 261 262 263 264 265 |
# File 'lib/action_dispatch/middleware/cookies.rb', line 256 def []=(key, ) if .is_a?(Hash) .symbolize_keys! else = { :value => } end [:expires] = 20.years.from_now @parent_jar[key] = end |
#signed ⇒ Object
267 268 269 |
# File 'lib/action_dispatch/middleware/cookies.rb', line 267 def signed @signed ||= SignedCookieJar.new(self, @secret) end |