Class: Pup::Application

Inherits:
Object show all
Defined in:
lib/pup/application.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeApplication

Returns a new instance of Application.



11
12
13
# File 'lib/pup/application.rb', line 11

def initialize
  @router = Routing::Router.new
end

Instance Attribute Details

#pathObject (readonly)

Returns the value of attribute path.



7
8
9
# File 'lib/pup/application.rb', line 7

def path
  @path
end

#requestObject (readonly)

Returns the value of attribute request.



7
8
9
# File 'lib/pup/application.rb', line 7

def request
  @request
end

#routerObject (readonly) Also known as: routes

Returns the value of attribute router.



7
8
9
# File 'lib/pup/application.rb', line 7

def router
  @router
end

#verbObject (readonly)

Returns the value of attribute verb.



7
8
9
# File 'lib/pup/application.rb', line 7

def verb
  @verb
end

Instance Method Details

#call(env) ⇒ Object



15
16
17
18
19
20
21
22
23
24
# File 'lib/pup/application.rb', line 15

def call(env)
  env = MethodOverride.apply_to(env)
  @request = Rack::Request.new(env)

  if router.has_routes?
    respond_to_request
  else
    pup_default_response
  end
end