Class: Dnsruby::Name::Label
- Inherits:
-
Object
- Object
- Dnsruby::Name::Label
- Includes:
- Comparable
- Defined in:
- lib/dnsruby/name.rb
Overview
Dnsruby::Label class
(RFC1035, section 3.1)
Constant Summary collapse
- MaxLabelLength =
63- @@max_length =
MaxLabelLength
Instance Attribute Summary collapse
-
#downcase ⇒ Object
readonly
Returns the value of attribute downcase.
-
#string ⇒ Object
readonly
Returns the value of attribute string.
Class Method Summary collapse
- .set_max_length(l) ⇒ Object
-
.split(arg) ⇒ Object
Split a Name into its component Labels.
Instance Method Summary collapse
- #<=>(other) ⇒ Object
- #==(other) ⇒ Object
- #eql?(other) ⇒ Boolean
- #hash ⇒ Object
-
#initialize(string) ⇒ Label
constructor
A new instance of Label.
- #inspect ⇒ Object
- #length ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(string) ⇒ Label
Returns a new instance of Label.
398 399 400 401 402 403 404 405 |
# File 'lib/dnsruby/name.rb', line 398 def initialize(string) if (string.length > @@max_length) raise ResolvError.new("Label too long (#{string.length}, max length=#{MaxLabelLength}). Label = #{string}") end @downcase = string.downcase @string = string @string_length = string.length end |
Instance Attribute Details
#downcase ⇒ Object (readonly)
Returns the value of attribute downcase.
406 407 408 |
# File 'lib/dnsruby/name.rb', line 406 def downcase @downcase end |
#string ⇒ Object (readonly)
Returns the value of attribute string.
406 407 408 |
# File 'lib/dnsruby/name.rb', line 406 def string @string end |
Class Method Details
.set_max_length(l) ⇒ Object
394 395 396 |
# File 'lib/dnsruby/name.rb', line 394 def self.set_max_length(l) @@max_length=l end |
.split(arg) ⇒ Object
Split a Name into its component Labels
390 391 392 |
# File 'lib/dnsruby/name.rb', line 390 def self.split(arg) return Name.split(arg) end |
Instance Method Details
#<=>(other) ⇒ Object
420 421 422 |
# File 'lib/dnsruby/name.rb', line 420 def <=>(other) return (@downcase <=> other.downcase) end |
#==(other) ⇒ Object
425 426 427 |
# File 'lib/dnsruby/name.rb', line 425 def ==(other) return @downcase == other.downcase end |
#eql?(other) ⇒ Boolean
429 430 431 |
# File 'lib/dnsruby/name.rb', line 429 def eql?(other) return self == other end |
#hash ⇒ Object
433 434 435 |
# File 'lib/dnsruby/name.rb', line 433 def hash return @downcase.hash end |
#inspect ⇒ Object
416 417 418 |
# File 'lib/dnsruby/name.rb', line 416 def inspect return "#<#{self.class} #{self.to_s}>" end |
#length ⇒ Object
412 413 414 |
# File 'lib/dnsruby/name.rb', line 412 def length return @string_length end |
#to_s ⇒ Object
408 409 410 |
# File 'lib/dnsruby/name.rb', line 408 def to_s return @string.to_s # + "." end |