Class: Authentication::Logic::ControllerAdapters::SinatraAdapter::Controller

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

Overview

Thin wrapper around request and response.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(request, response) ⇒ Controller

Returns a new instance of Controller.



34
35
36
37
# File 'lib/auth/logic/controller_adapters/sinatra_adapter.rb', line 34

def initialize(request, response)
  @request = request
  @cookies = Cookies.new(request, response)
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

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



43
44
45
# File 'lib/auth/logic/controller_adapters/sinatra_adapter.rb', line 43

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

Instance Attribute Details

#cookiesObject (readonly)

Returns the value of attribute cookies.



32
33
34
# File 'lib/auth/logic/controller_adapters/sinatra_adapter.rb', line 32

def cookies
  @cookies
end

#requestObject (readonly)

Returns the value of attribute request.



32
33
34
# File 'lib/auth/logic/controller_adapters/sinatra_adapter.rb', line 32

def request
  @request
end

#responseObject (readonly)

Returns the value of attribute response.



32
33
34
# File 'lib/auth/logic/controller_adapters/sinatra_adapter.rb', line 32

def response
  @response
end

Instance Method Details

#sessionObject



39
40
41
# File 'lib/auth/logic/controller_adapters/sinatra_adapter.rb', line 39

def session
  env["rack.session"]
end