Class: Authlogic::ControllerAdapters::SinatraAdapter::Cookies

Inherits:
Object
  • Object
show all
Defined in:
lib/authlogic/controller_adapters/sinatra_adapter.rb

Overview

Cookie management functions

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(request, response) ⇒ Cookies

Returns a new instance of Cookies.



11
12
13
14
# File 'lib/authlogic/controller_adapters/sinatra_adapter.rb', line 11

def initialize(request, response)
  @request = request
  @response = response
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(meth, *args, &block) ⇒ Object



24
25
26
# File 'lib/authlogic/controller_adapters/sinatra_adapter.rb', line 24

def method_missing(meth, *args, &block)
  @request.cookies.send(meth, *args, &block)
end

Instance Attribute Details

#requestObject (readonly)

Returns the value of attribute request.



9
10
11
# File 'lib/authlogic/controller_adapters/sinatra_adapter.rb', line 9

def request
  @request
end

#responseObject (readonly)

Returns the value of attribute response.



9
10
11
# File 'lib/authlogic/controller_adapters/sinatra_adapter.rb', line 9

def response
  @response
end

Instance Method Details

#[]=(key, options) ⇒ Object



20
21
22
# File 'lib/authlogic/controller_adapters/sinatra_adapter.rb', line 20

def []=(key, options)
  @response.set_cookie(key, options)
end

#delete(key, options = {}) ⇒ Object



16
17
18
# File 'lib/authlogic/controller_adapters/sinatra_adapter.rb', line 16

def delete(key, options = {})
  @response.delete_cookie(key, options)
end