Class: RRs::Label::Str
- Inherits:
-
Object
- Object
- RRs::Label::Str
- Defined in:
- lib/rrs/label.rb
Overview
:nodoc:
Instance Attribute Summary collapse
-
#downcase ⇒ Object
readonly
Returns the value of attribute downcase.
-
#string ⇒ Object
readonly
Returns the value of attribute string.
Instance Method Summary collapse
- #==(other) ⇒ Object
- #eql?(other) ⇒ Boolean
- #hash ⇒ Object
-
#initialize(string) ⇒ Str
constructor
A new instance of Str.
- #inspect ⇒ Object
- #to_s ⇒ Object
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
#downcase ⇒ Object (readonly)
Returns the value of attribute downcase.
16 17 18 |
# File 'lib/rrs/label.rb', line 16 def downcase @downcase end |
#string ⇒ Object (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
30 31 32 |
# File 'lib/rrs/label.rb', line 30 def eql?(other) return self == other end |
#hash ⇒ Object
34 35 36 |
# File 'lib/rrs/label.rb', line 34 def hash return @downcase.hash end |
#inspect ⇒ Object
22 23 24 |
# File 'lib/rrs/label.rb', line 22 def inspect return "#<#{self.class} #{self}>" end |
#to_s ⇒ Object
18 19 20 |
# File 'lib/rrs/label.rb', line 18 def to_s return @string end |