Module: Rango::Router::Dispatcher

Attributes

Class Attributes

router_adapter [RW] public

Returns the value of attribute router_adapter.

Public Visibility

Public Class Method Summary

extended(object)
included(klass)
install_hook(klass)
route_to(env, app)

Public Class Method Details

extended

public extended(object)
[View source]


12
13
14
# File 'lib/rango/router/dispatcher.rb', line 12

def extended(object)
  self.install_hook(object.class)
end

included

public included(klass)
[View source]


8
9
10
# File 'lib/rango/router/dispatcher.rb', line 8

def included(klass)
  self.install_hook(klass)
end

install_hook

public install_hook(klass)

Meta Tags

Parameters:

Raises:

[TypeError]
[View source]


16
17
18
19
20
# File 'lib/rango/router/dispatcher.rb', line 16

def install_hook(klass)
  klass.send(:include, self.router_adapter)
rescue TypeError
  raise TypeError, "You must set the Dispatcher.router_adapter first. For example Dispatcher.router_adapter = Rango::Router::RackRouter"
end

route_to

public route_to(env, app)
[View source]


22
23
24
25
# File 'lib/rango/router/dispatcher.rb', line 22

def route_to(env, app)
  Rango.logger.inspect("Routing request to #{app.inspect}")
  app.call(env)
end