Class: Rango::Router
- Inherits:
-
Object
- Object
- Rango::Router
- Defined in:
- lib/rango/router.rb
Class Method Summary collapse
- .app ⇒ Object
- .app=(app) ⇒ Object
- .implement(router, &block) ⇒ Object
- .router ⇒ Object
- .router=(router) ⇒ Object
- .set_rack_env(env) ⇒ Object
- .use(router) ⇒ Object
Class Method Details
.app ⇒ Object
21 22 23 24 25 |
# File 'lib/rango/router.rb', line 21 def self.app @@app rescue NameError raise Exceptions::RouterNotInitialized, "You have to assign your router application to Rango::Router.app\nFor example Rango::Router.app = Usher::Interface.for(:rack, &block)" end |
.app=(app) ⇒ Object
27 28 29 |
# File 'lib/rango/router.rb', line 27 def self.app=(app) @@app = app end |
.implement(router, &block) ⇒ Object
41 42 43 |
# File 'lib/rango/router.rb', line 41 def self.implement(router, &block) @@routers[router] = block end |
.router ⇒ Object
31 32 33 34 35 |
# File 'lib/rango/router.rb', line 31 def self.router @@router rescue NameError raise "You have to run Rango::Router.use(router_name) first!" end |
.router=(router) ⇒ Object
37 38 39 |
# File 'lib/rango/router.rb', line 37 def self.router=(router) @@router = router end |
.set_rack_env(env) ⇒ Object
51 52 53 54 55 |
# File 'lib/rango/router.rb', line 51 def self.set_rack_env(env) unless env["rango.router.params"] @@routers[self.router].call(env) end end |