Class: ActionController::PermanentCookieJar

Inherits:
CookieJar show all
Defined in:
lib/action_controller/cookies.rb

Overview

:nodoc:

Instance Method Summary collapse

Methods inherited from CookieJar

#[], #delete, #permanent

Constructor Details

#initialize(parent_jar) ⇒ PermanentCookieJar

Returns a new instance of PermanentCookieJar.



132
133
134
# File 'lib/action_controller/cookies.rb', line 132

def initialize(parent_jar)
  @parent_jar = parent_jar
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *arguments, &block) ⇒ Object



155
156
157
# File 'lib/action_controller/cookies.rb', line 155

def method_missing(method, *arguments, &block)
  @parent_jar.send(method, *arguments, &block)
end

Instance Method Details

#[]=(key, options) ⇒ Object



136
137
138
139
140
141
142
143
144
145
# File 'lib/action_controller/cookies.rb', line 136

def []=(key, options)
  if options.is_a?(Hash)
    options.symbolize_keys!
  else
    options = { :value => options }
  end
  
  options[:expires] = 20.years.from_now
  @parent_jar[key] = options
end

#controllerObject



151
152
153
# File 'lib/action_controller/cookies.rb', line 151

def controller
  @parent_jar.controller
end

#signedObject



147
148
149
# File 'lib/action_controller/cookies.rb', line 147

def signed
  @signed ||= SignedCookieJar.new(self)
end