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

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(request, response) ⇒ Cookies

Returns a new instance of Cookies.



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

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



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

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

Instance Attribute Details

#requestObject (readonly)

Returns the value of attribute request.



6
7
8
# File 'lib/authlogic/controller_adapters/sinatra_adapter.rb', line 6

def request
  @request
end

#responseObject (readonly)

Returns the value of attribute response.



6
7
8
# File 'lib/authlogic/controller_adapters/sinatra_adapter.rb', line 6

def response
  @response
end

Instance Method Details

#[]=(key, options) ⇒ Object



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

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

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



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

def delete(key, options = {})
  @request.cookies.delete(key)
end