def generate_url(path, base = "/")
      return root_uri.to_s if path.nil? or path.empty?
      return path if path_is_anchor?(path)
      return add_scheme(path) if path_is_schemeless?(path)
      return path if Utils.path_is_absolute?(path)

      combine_segments(root_uri, base, path).to_s
    end
def generate_url(path, base = "/")
      return root_uri.to_s if path.nil? or path.empty?
      return path if path_is_anchor?(path)
      return add_scheme(path) if path_is_schemeless?(path)
      return path if Utils.path_is_absolute?(path)

      combine_segments(root_uri, base, path).to_s
    end
Create a new instance with the given URL options.

 Initializing without a host setting raises an error, as do unknown keys.

 @param [Hash] url_options
 @option url_options [String] :host (required)
 @option url_options [String, Integer] :port
 @option url_options [String] :path root path
 @option url_options [String] :scheme URL scheme ("http" is default)
 @option url_options [String] :protocol alias for :scheme
 Generate an absolute URL from a relative URL.

 If the passed path is already an absolute URL or just an anchor
 reference, it will be returned as-is.
 If passed a blank path, the "root URL" will be returned. The root URL is
 the URL that the {#url_options} would generate by themselves.

 An optional base can be specified. The base is another relative path from
 the root that specifies an "offset" from which the path was found in. A
 common use-case is to convert a relative path found in a stylesheet which
 resides in a subdirectory.

 @example Normal conversions
   generator = Roadie::UrlGenerator.new host: "foo.com", scheme: "https"
   generator.generate_url("bar.html") # => "https://foo.com/bar.html"
   generator.generate_url("/bar.html") # => "https://foo.com/bar.html"
   generator.generate_url("") # => "https://foo.com"

 @example Conversions with a base
   generator = Roadie::UrlGenerator.new host: "foo.com", scheme: "https"
   generator.generate_url("../images/logo.png", "/css") # => "https://foo.com/images/logo.png"
   generator.generate_url("../images/logo.png", "/assets/css") # => "https://foo.com/assets/images/logo.png"

 @param [String] base The base which the relative path comes from
 @return [String] an absolute URL