Class: Crystal::Routes::Configurator
- Defined in:
- lib/crystal/router/configurator.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(router) ⇒ Configurator
constructor
A new instance of Configurator.
- #named_route(*args, &block) ⇒ Object
Constructor Details
#initialize(router) ⇒ Configurator
Returns a new instance of Configurator.
4 5 6 |
# File 'lib/crystal/router/configurator.rb', line 4 def initialize router @router = router end |
Class Method Details
.routes(&block) ⇒ Object
17 18 19 |
# File 'lib/crystal/router/configurator.rb', line 17 def routes &block block.call Configurator.new(router) end |
Instance Method Details
#named_route(*args, &block) ⇒ Object
8 9 10 11 12 |
# File 'lib/crystal/router/configurator.rb', line 8 def named_route *args, &block named_router = @router.routes[:named_router] raise "There's no NamedRouter (use config to add it)!" unless named_router named_router.add *args, &block end |