Skip to content

Maintenance Ruby 3.3 gets fixes, but no new features. Switch to Ruby 4.0 →

instance method

Resolv::DNS::Name#to_s

to_s

returns the domain name as a string.

The domain name doesn’t have a trailing dot even if the name object is absolute.

Example:

Example
p Resolv::DNS::Name.create("x.y.z.").to_s #=> "x.y.z"
p Resolv::DNS::Name.create("x.y.z").to_s #=> "x.y.z"
See also #subdomain_of? #absolute? also in 3.4 · 3.2 · 3.1 · 3.0