lib/roda/plugins/sinatra_helpers.rb
# Generates the absolute URI for a given path in the app.
# Takes Rack routers and reverse proxies into account.
Generates the absolute URI for a given path in the app.
Takes Rack routers and reverse proxies into account.
Generates the absolute URI for a given path in the app . Takes Rack routers and reverse proxies into account .
def uri(addr = nil, absolute = true, add_script_name = true)
          addr = addr.to_s if addr
          return addr if addr =~ /\A[A-z][A-z0-9\+\.\-]*:/
          uri = if absolute
            h = if @env.has_key?("HTTP_X_FORWARDED_HOST") || port != (ssl? ? 443 : 80)
              host_with_port
            else
              host
            end
            ["http#{'s' if ssl?}://#{h}"]
          else
            ['']
          end
          uri << script_name.to_s if add_script_name
          uri << (addr || path_info)
          File.join(uri)
        end
def uri ( addr = nil , absolute = true , add_script_name = true ) addr = addr . to_s if addr return addr if addr =~ / \A [A-z][A-z0-9 \+ \. \- ]*: / uri = if absolute h = if @env . has_key? ( "HTTP_X_FORWARDED_HOST" ) || port != ( ssl? ? 443 : 80 ) host_with_port else host end [ "http#{'s' if ssl?}://#{h}" ] else [ '' ] end uri << script_name . to_s if add_script_name uri << ( addr || path_info ) File . join ( uri ) end
Generates the absolute URI for a given path in the app.
Generates the absolute URI for a given path in the app .
addr
absolute
add_script_name