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.



138
139
140
# File 'lib/action_controller/cookies.rb', line 138

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



161
162
163
# File 'lib/action_controller/cookies.rb', line 161

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

Instance Method Details

#[]=(key, options) ⇒ Object



142
143
144
145
146
147
148
149
150
151
# File 'lib/action_controller/cookies.rb', line 142

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



157
158
159
# File 'lib/action_controller/cookies.rb', line 157

def controller
  @parent_jar.controller
end

#signedObject



153
154
155
# File 'lib/action_controller/cookies.rb', line 153

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