Class: Rage::Router::DSL
- Inherits:
-
Object
- Object
- Rage::Router::DSL
- Defined in:
- lib/rage/router/dsl.rb
Defined Under Namespace
Classes: Handler
Instance Method Summary collapse
- #draw(&block) ⇒ Object
-
#initialize(router) ⇒ DSL
constructor
A new instance of DSL.
Constructor Details
#initialize(router) ⇒ DSL
Returns a new instance of DSL.
9 10 11 |
# File 'lib/rage/router/dsl.rb', line 9 def initialize(router) @router = router end |
Instance Method Details
#draw(&block) ⇒ Object
13 14 15 16 17 18 19 20 |
# File 'lib/rage/router/dsl.rb', line 13 def draw(&block) handler = Handler.new(@router) Rage::Extension.__routes.each { |block| handler.instance_eval(&block) } handler.instance_eval(&block) # propagate route definitions to Rails for `rails routes` to work Rails.application.routes.draw(&block) if Rage.config.internal.rails_mode end |