Module: TrueWeb::Controller::Controllers
- Included in:
- TrueWeb::Controller
- Defined in:
- lib/true-web/controller.rb
Defined Under Namespace
Modules: ClassMethods
Class Method Summary collapse
Instance Method Summary collapse
-
#call!(env) ⇒ Object
Overrode call! to speed up routing to subresources.
Class Method Details
.included(mod) ⇒ Object
102 103 104 |
# File 'lib/true-web/controller.rb', line 102 def self.included(mod) mod.extend(ClassMethods) end |
Instance Method Details
#call!(env) ⇒ Object
Overrode call! to speed up routing to subresources.
107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 |
# File 'lib/true-web/controller.rb', line 107 def call!(env) self.class.controllers.each do |controller| request = ::Sinatra::Request.new(env) routes = controller.routes[request.request_method] || [] path = unescape(request.path_info) routes.each do |pattern, keys, conditions, block| if pattern.match(path) subapp_instance = controller.allocate subapp_instance.send(:initialize, nil) response = subapp_instance.call(env) return response if response[0] != 404 end end end super end |