Class: RRs::Label::Str

Inherits:
Object
  • Object
show all
Defined in:
lib/rrs/label.rb

Overview

:nodoc:

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(string) ⇒ Str

Returns a new instance of Str.



10
11
12
13
14
15
# File 'lib/rrs/label.rb', line 10

def initialize(string)
  @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

#downcaseObject (readonly)

Returns the value of attribute downcase.



16
17
18
# File 'lib/rrs/label.rb', line 16

def downcase
  @downcase
end

#stringObject (readonly)

Returns the value of attribute string.



16
17
18
# File 'lib/rrs/label.rb', line 16

def string
  @string
end

Instance Method Details

#==(other) ⇒ Object



26
27
28
# File 'lib/rrs/label.rb', line 26

def ==(other)
  return self.class == other.class && @downcase == other.downcase
end

#eql?(other) ⇒ Boolean

Returns:

  • (Boolean)


30
31
32
# File 'lib/rrs/label.rb', line 30

def eql?(other)
  return self == other
end

#hashObject



34
35
36
# File 'lib/rrs/label.rb', line 34

def hash
  return @downcase.hash
end

#inspectObject



22
23
24
# File 'lib/rrs/label.rb', line 22

def inspect
  return "#<#{self.class} #{self}>"
end

#to_sObject



18
19
20
# File 'lib/rrs/label.rb', line 18

def to_s
  return @string
end