Method: Iri#to_s

Defined in:
lib/iri.rb

#to_sString

Converts the Iri object to a string representation of the URI.

When local mode is enabled, only the path, query, and fragment parts are included. Otherwise, the full URI including scheme, host, and port is returned.

Returns:

  • (String)

    String representation of the URI



76
77
78
79
80
81
82
83
84
85
86
87
# File 'lib/iri.rb', line 76

def to_s
  u = the_uri
  if @local
    [
      u.path,
      u.query ? "?#{u.query}" : '',
      u.fragment ? "##{u.fragment}" : ''
    ].join
  else
    u.to_s
  end
end