class method self.build_host_url

Ruby on Rails 4.0.13

Since v4.0.13 Private

Available in: v4.0.13 v4.1.16 v4.2.9 v5.2.8.1 v6.0.6 v6.1.7.10 v7.0.10 v7.1.6 v7.2.3 v8.0.4 v8.1.2

Signature

self.build_host_url(options)

No documentation comment.

Parameters

options req
Source
# File actionpack/lib/action_dispatch/http/url.rb, line 65
        def build_host_url(options)
          if options[:host].blank? && options[:only_path].blank?
            raise ArgumentError, 'Missing host to link to! Please provide the :host parameter, set default_url_options[:host], or set :only_path to true'
          end

          result = ""

          unless options[:only_path]
            if match = options[:host].match(HOST_REGEXP)
              options[:protocol] ||= match[1] unless options[:protocol] == false
              options[:host]       = match[2]
              options[:port]       = match[3] unless options.key?(:port)
            end

            options[:protocol] = normalize_protocol(options)
            options[:host]     = normalize_host(options)
            options[:port]     = normalize_port(options)

            result << options[:protocol]
            result << rewrite_authentication(options)
            result << options[:host]
            result << ":#{options[:port]}" if options[:port]
          end
          result
        end

Defined in actionpack/lib/action_dispatch/http/url.rb line 65 · View on GitHub · Improve this page · Find usages on GitHub

Defined in ActionDispatch::Http::URL

Type at least 2 characters to search.

↑↓ navigate · open · esc close