Class: Resolv::DNS::Label::Str
Do not use. This class is for internal use only.
| Relationships & Source Files | |
| Inherits: | Object |
| Defined in: | lib/resolv.rb |
Class Method Summary
- .new(string) ⇒ Str constructor
Instance Attribute Summary
Instance Method Summary
Constructor Details
.new(string) ⇒ Str
# File 'lib/resolv.rb', line 1317
def initialize(string) # A label is limited to 63 octets. [RFC 1035 2.3.4] Checking it here # makes it an invariant of the object: every label, however it was # built, fits in its length octet and cannot wrap it. Callers turn # this into the error their own contract promises. if string.bytesize > 63 raise ArgumentError, "DNS label is too long (#{string.bytesize} bytes, max 63): #{string.inspect}" end @string = string # case insensivity of DNS labels doesn't apply non-ASCII characters. [RFC 4343] # This assumes @string is given in ASCII compatible encoding. @downcase = string.b.downcase end
Instance Attribute Details
#downcase (readonly)
[ GitHub ]# File 'lib/resolv.rb', line 1330
attr_reader :string, :downcase
#string (readonly)
[ GitHub ]# File 'lib/resolv.rb', line 1330
attr_reader :string, :downcase
Instance Method Details
#==(other)
[ GitHub ]# File 'lib/resolv.rb', line 1340
def ==(other) return self.class == other.class && @downcase == other.downcase end
#eql?(other) ⇒ Boolean
# File 'lib/resolv.rb', line 1344
def eql?(other) return self == other end
#hash
[ GitHub ]# File 'lib/resolv.rb', line 1348
def hash return @downcase.hash end
#inspect
[ GitHub ]# File 'lib/resolv.rb', line 1336
def inspect return "#<#{self.class} #{self}>" end
#to_s
[ GitHub ]# File 'lib/resolv.rb', line 1332
def to_s return @string end