Class: Fresco::Application
- Inherits:
-
Object
- Object
- Fresco::Application
- Defined in:
- lib/fresco/application.rb
Instance Method Summary collapse
-
#routes(&blk) ⇒ Object
‘routes` is dual-purpose: with a block it evaluates the DSL on the singleton Router; without one it returns the Router so `fresco build` can read `entries` back out.
Instance Method Details
#routes(&blk) ⇒ Object
‘routes` is dual-purpose: with a block it evaluates the DSL on the singleton Router; without one it returns the Router so `fresco build` can read `entries` back out. Mirrors Rails’ ‘Rails.application.routes.draw { … }` but folds .draw into the same accessor — one less name to remember.
7 8 9 10 11 |
# File 'lib/fresco/application.rb', line 7 def routes(&blk) @router ||= Fresco::Router.new @router.instance_eval(&blk) if blk @router end |