class Resolv::DNS::Name
Public Class Methods
(Resolv::DNS::dns_name arg) → untyped
Source
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/stdlib/resolv/0/resolv.rbs, line 595
def self.create: (Resolv::DNS::dns_name arg) -> untyped
(Array[Resolv::DNS::Label::Str] labels, ?bool absolute) → untyped
Source
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/stdlib/resolv/0/resolv.rbs, line 655
def initialize: (Array[Resolv::DNS::Label::Str] labels, ?bool absolute) -> untyped
Public Instance Methods
(self other) → bool
Source
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/stdlib/resolv/0/resolv.rbs, line 597
def ==: (self other) -> bool
Also aliased as: eql?
(Integer i) → Resolv::DNS::Label::Str?
Source
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/stdlib/resolv/0/resolv.rbs, line 599
def []: (Integer i) -> Resolv::DNS::Label::Str?
() → bool
Source
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/stdlib/resolv/0/resolv.rbs, line 607
def absolute?: () -> bool
True if this name is absolute.
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/stdlib/resolv/0/resolv.rbs, line 611
def hash: () -> Integer
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/stdlib/resolv/0/resolv.rbs, line 613
def inspect: () -> String
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/stdlib/resolv/0/resolv.rbs, line 615
def length: () -> Integer
(self other) → bool
Source
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/stdlib/resolv/0/resolv.rbs, line 633
def subdomain_of?: (self other) -> bool
Returns true if other is a subdomain.
Example:
domain = Resolv::DNS::Name.create("y.z") p Resolv::DNS::Name.create("w.x.y.z").subdomain_of?(domain) #=> true p Resolv::DNS::Name.create("x.y.z").subdomain_of?(domain) #=> true p Resolv::DNS::Name.create("y.z").subdomain_of?(domain) #=> false p Resolv::DNS::Name.create("z").subdomain_of?(domain) #=> false p Resolv::DNS::Name.create("x.y.z.").subdomain_of?(domain) #=> false p Resolv::DNS::Name.create("w.z").subdomain_of?(domain) #=> false
() → Array[Resolv::DNS::Label::Str]
Source
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/stdlib/resolv/0/resolv.rbs, line 635
def to_a: () -> Array[Resolv::DNS::Label::Str]
() → untyped
Source
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/stdlib/resolv/0/resolv.rbs, line 651
def to_s: () -> untyped
returns the domain name as a string.
The domain name doesnβt have a trailing dot even if the name object is absolute.
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"