def map(name, path = nil)
    @locations ||= {}
    if name.to_sym == :root
      @locations[:root] = cleanup_paths("/#{path}/")
      self.class.class_eval do
        define_method "#{name}_path" do |*paths|
          cleanup_paths("/#{@locations[:root]}/?")
        end
      end
    else
      @locations[name.to_sym] = cleanup_paths(path || name.to_s)
      self.class.class_eval do
        define_method("#{name}_path") do |*paths|
          map_path_to(@locations[name.to_sym], paths << "/?")
        end
      end
    end
    Delegator.delegate "#{name}_path"
  end
def map(name, path = nil)
    @locations ||= {}
    if name.to_sym == :root
      @locations[:root] = cleanup_paths("/#{path}/")
      self.class.class_eval do
        define_method "#{name}_path" do |*paths|
          cleanup_paths("/#{@locations[:root]}/?")
        end
      end
    else
      @locations[name.to_sym] = cleanup_paths(path || name.to_s)
      self.class.class_eval do
        define_method("#{name}_path") do |*paths|
          map_path_to(@locations[name.to_sym], paths << "/?")
        end
      end
    end
    Delegator.delegate "#{name}_path"
  end
Write URL path method for use in HTTP methods.

 The map method most be used by following syntax:

   map <name>, <path>

 If name is equal :root, then returns path ended by slash "/".

   map :root,    "tasks"       #=> /tasks/
   map :changes, "last-changes #=> /tasks/last-changes