- D
- E
- H
- N
- O
- P
- R
- S
- U
IP_HOST_REGEXP | = | /\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/ |
HOST_REGEXP | = | /(^.*:\/\/)?([^:]+)(?::(\d+$))?/ |
PROTOCOL_REGEXP | = | /^([^:]+)(:)?(\/\/)?$/ |
# File actionpack/lib/action_dispatch/http/url.rb, line 32 def url_for(options = {}) options = options.dup path = options.delete(:script_name).to_s.chomp("/") path << options.delete(:path).to_s add_trailing_slash(path) if options[:trailing_slash] params = options[:params].is_a?(Hash) ? options[:params] : options.slice(:params) params.reject! { |_,v| v.to_param.nil? } result = build_host_url(options) result << path result << "?#{params.to_query}" unless params.empty? result << "##{Journey::Router::Utils.escape_fragment(options[:anchor].to_param.to_s)}" if options[:anchor] result end
Returns the domain part of a host, such as “rubyonrails.org” in “www.rubyonrails.org”. You can specify a
different tld_length
, such as 2 to catch rubyonrails.co.uk in
“www.rubyonrails.co.uk”.
Returns the host for this request, such as example.com.
Returns a host:port string for this request, such as “example.com” or “example.com:8080”.
Returns a number port suffix like 8080 if the port number of this request is not the default HTTP port 80 or HTTPS port 443.
Returns the port number of this request as an integer.
Returns a string port suffix, including colon, like “:8080” if the port number of this request is not the default HTTP port 80 or HTTPS port 443.
Returns the host for this request, such as “example.com”.
Returns the standard port number for this request's protocol.
Returns whether this request is using the standard port
Returns all the subdomains as a string, so "dev.www"
would be returned for “dev.www.rubyonrails.org”. You can specify a
different tld_length
, such as 2 to catch
"www"
instead of
"www.rubyonrails"
in “www.rubyonrails.co.uk”.
Returns all the subdomains as an array, so ["dev",
"www"]
would be returned for “dev.www.rubyonrails.org”. You can specify a
different tld_length
, such as 2 to catch
["www"]
instead of ["www",
"rubyonrails"]
in “www.rubyonrails.co.uk”.