Class: MVCLI::Router::DSL
- Inherits:
- BasicObject
- Defined in:
- lib/mvcli/router.rb
Instance Attribute Summary collapse
-
#router ⇒ Object
readonly
Returns the value of attribute router.
Instance Method Summary collapse
-
#initialize ⇒ DSL
constructor
A new instance of DSL.
- #macro(options) ⇒ Object
- #match(options) ⇒ Object
- #proc(&body) ⇒ Object
Constructor Details
#initialize ⇒ DSL
Returns a new instance of DSL.
35 36 37 |
# File 'lib/mvcli/router.rb', line 35 def initialize @router = Router.new end |
Instance Attribute Details
#router ⇒ Object (readonly)
Returns the value of attribute router.
33 34 35 |
# File 'lib/mvcli/router.rb', line 33 def router @router end |
Instance Method Details
#macro(options) ⇒ Object
39 40 41 |
# File 'lib/mvcli/router.rb', line 39 def macro() @router.macros.push Macro.new end |
#match(options) ⇒ Object
43 44 45 46 47 |
# File 'lib/mvcli/router.rb', line 43 def match() pattern, action = .first .delete pattern @router.routes << Route.new(router, pattern, action, ) end |
#proc(&body) ⇒ Object
49 50 51 |
# File 'lib/mvcli/router.rb', line 49 def proc(&body) ::Proc.new &body end |