Class: Resolv::DNS::Label::Str
- Inherits:
-
Object
- Object
- Resolv::DNS::Label::Str
- Defined in:
- lib/net/dns/resolv.rb,
lib/net/dns/resolvx.rb
Overview
A String wrapper that compares (and hashes) case insensitively, used to represent DNS labels.
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
-
#<=>(s) ⇒ Object
Case-insensitive comparison.
- #==(other) ⇒ Object
- #eql?(other) ⇒ Boolean
- #hash ⇒ Object
-
#initialize(string) ⇒ Str
constructor
:nodoc:.
- #inspect ⇒ Object
- #to_s ⇒ Object
-
#to_str ⇒ Object
Str is-a String, allow it to be compared to one.
Constructor Details
#initialize(string) ⇒ Str
:nodoc:
994 995 996 997 |
# File 'lib/net/dns/resolv.rb', line 994 def initialize(string) # :nodoc: @string = string @downcase = string.downcase end |
Instance Attribute Details
#downcase ⇒ Object (readonly)
Returns the value of attribute downcase.
998 999 1000 |
# File 'lib/net/dns/resolv.rb', line 998 def downcase @downcase end |
#string ⇒ Object (readonly)
Returns the value of attribute string.
998 999 1000 |
# File 'lib/net/dns/resolv.rb', line 998 def string @string end |
Instance Method Details
#<=>(s) ⇒ Object
Case-insensitive comparison.
71 72 73 |
# File 'lib/net/dns/resolvx.rb', line 71 def <=>(s) @downcase <=> s.downcase end |
#==(other) ⇒ Object
1008 1009 1010 |
# File 'lib/net/dns/resolv.rb', line 1008 def ==(other) return @downcase == other.downcase end |
#eql?(other) ⇒ Boolean
1012 1013 1014 |
# File 'lib/net/dns/resolv.rb', line 1012 def eql?(other) return self == other end |
#hash ⇒ Object
1016 1017 1018 |
# File 'lib/net/dns/resolv.rb', line 1016 def hash return @downcase.hash end |
#inspect ⇒ Object
1004 1005 1006 |
# File 'lib/net/dns/resolv.rb', line 1004 def inspect return "#<#{self.class} #{self.to_s.inspect}>" end |
#to_s ⇒ Object
1000 1001 1002 |
# File 'lib/net/dns/resolv.rb', line 1000 def to_s return @string end |
#to_str ⇒ Object
Str is-a String, allow it to be compared to one.
67 68 69 |
# File 'lib/net/dns/resolvx.rb', line 67 def to_str return @string end |