Class: MVCLI::Router::DSL

Inherits:
BasicObject
Defined in:
lib/mvcli/router.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeDSL

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

#routerObject (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(options)
  @router.macros.push Macro.new options
end

#match(options) ⇒ Object



43
44
45
46
47
# File 'lib/mvcli/router.rb', line 43

def match(options)
  pattern, action = options.first
  options.delete pattern
  @router.routes << Route.new(router, pattern, action, options)
end

#proc(&body) ⇒ Object



49
50
51
# File 'lib/mvcli/router.rb', line 49

def proc(&body)
  ::Proc.new &body
end