module Roda::RodaPlugins::Path::InstanceMethods

def _base_url

The string to prepend to the path to make the path a URL.
def _base_url
  r = @_request
  scheme = r.scheme
  port = r.port
  "#{scheme}://#{r.host}#{":#{port}" unless DEFAULT_PORTS[scheme] == port}"
end

def path(obj, *args, &block)

:add_script_name option is true, this prepends the SCRIPT_NAME to the path.
had its class previously registered with the application. If the app's
Return a path based on the class of the object. The object passed must have
def path(obj, *args, &block)
  app = self.class
  opts = app.opts
  klass =  opts[:path_class_by_name] ? obj.class.name : obj.class
  unless meth = opts[:path_class_methods][klass]
    raise RodaError, "unrecognized object given to Roda#path: #{obj.inspect}"
  end
  path = send(meth, obj, *args, &block)
  path = request.script_name.to_s + path if opts[:add_script_name]
  path
end

def url(*args, &block)

Similar to #path, but returns a complete URL.
def url(*args, &block)
  "#{_base_url}#{path(*args, &block)}"
end