Class: Pakada::Dispatch
- Inherits:
-
Object
show all
- Includes:
- Module
- Defined in:
- lib/pakada/dispatch/module.rb,
lib/pakada/dispatch/version.rb,
lib/pakada/dispatch/controller.rb,
lib/pakada/dispatch/rendering_context.rb,
lib/pakada/dispatch.rb
Defined Under Namespace
Modules: Controller, Module, RenderingContext
Constant Summary
collapse
- VERSION =
"0.3.4"
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
Returns a new instance of Dispatch.
16
17
18
|
# File 'lib/pakada/dispatch.rb', line 16
def initialize
@router = HttpRouter.new
end
|
Instance Attribute Details
#router ⇒ Object
Returns the value of attribute router.
14
15
16
|
# File 'lib/pakada/dispatch.rb', line 14
def router
@router
end
|
Instance Method Details
#create_controller(&block) ⇒ Object
38
39
40
41
42
43
44
|
# File 'lib/pakada/dispatch.rb', line 38
def create_controller(&block)
Class.new {
include Pakada.safety(Pakada::Dispatch::Controller)
include Hooked
class_eval &block if block
}
end
|
#hooks ⇒ Object
20
21
22
|
# File 'lib/pakada/dispatch.rb', line 20
def hooks
Pakada.instance.instead_of(:request) {|env| request env }
end
|
#request(env) ⇒ Object
46
47
48
|
# File 'lib/pakada/dispatch.rb', line 46
def request(env)
router.call env
end
|