       # handle namespaced controller name (add namespace prefix)
       route.handleNamespacedController(@_namespace)
       
+      route.definePathHelper()
+      
       if object? and typeof object == 'object' 
         route.set('blank',no) if (object.keep? and object.keep) or (object.blank? and not object.blank)
-        route.set('yield',object.container|| object.yield )
+        route.set('yield',object.container || object.yield )
       Pinkman.routes.push(route)
       return(route)
       

  root: (controller) ->
    @match('/',controller: controller)
  
Pinkman.router = PinkmanRouter
  handleNamespacedController: (namespace) ->
    @set('controller',"#{namespace.replace(/\//g,'-')}-#{@controller}") if namespace and @controller and not (new RegExp("^#{namespace}")).test(@controller)

  definePathHelper: ->
    helperName = @controller.replace(/-/g,'_') + '_path'
    Pinkman.path_helpers.push helperName
    $p.defineGlobalVar helperName, (args...) =>
      i = 0
      array = []
      for level in @path.levels.collection
        if level.dynamic
          array.push(args[i])
          i = i + 1
        else
          array.push(level.entry)
      '/' + array.join('/')
        
  
# Routes collection. Have the capability to search a string through routes and storage all defined routes. Used once in Pinkman.routes
class window.PinkmanRoutes extends Pinkman.collection
