- D
- E
- F
- 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 39 def full_url_for(options) host = options[:host] protocol = options[:protocol] port = options[:port] unless host raise ArgumentError, 'Missing host to link to! Please provide the :host parameter, set default_url_options[:host], or set :only_path to true' end build_host_url(host, port, protocol, options, path_for(options)) end
# File actionpack/lib/action_dispatch/http/url.rb, line 51 def path_for(options) path = options[:script_name].to_s.chomp("/") path << options[:path] if options.key?(:path) add_trailing_slash(path) if options[:trailing_slash] add_params(path, options[:params]) if options.key?(:params) add_anchor(path, options[:anchor]) if options.key?(:anchor) path 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”.