Class: Dnsync::Answer
- Inherits:
-
Object
- Object
- Dnsync::Answer
- Includes:
- Comparable
- Defined in:
- lib/dnsync/answer.rb
Instance Attribute Summary collapse
-
#content ⇒ Object
readonly
Returns the value of attribute content.
-
#priority ⇒ Object
readonly
Returns the value of attribute priority.
Instance Method Summary collapse
- #<=>(other) ⇒ Object
- #hash ⇒ Object
-
#initialize(content, priority = nil) ⇒ Answer
constructor
A new instance of Answer.
Constructor Details
#initialize(content, priority = nil) ⇒ Answer
Returns a new instance of Answer.
7 8 9 10 11 12 13 14 15 16 |
# File 'lib/dnsync/answer.rb', line 7 def initialize(content, priority = nil) unless content.present? raise ArgumentError, 'content must be provided' end @content = content @priority = priority freeze end |
Instance Attribute Details
#content ⇒ Object (readonly)
Returns the value of attribute content.
5 6 7 |
# File 'lib/dnsync/answer.rb', line 5 def content @content end |
#priority ⇒ Object (readonly)
Returns the value of attribute priority.
5 6 7 |
# File 'lib/dnsync/answer.rb', line 5 def priority @priority end |
Instance Method Details
#<=>(other) ⇒ Object
18 19 20 |
# File 'lib/dnsync/answer.rb', line 18 def <=>(other) [ content, priority ] <=> [ other.content, other.priority ] end |
#hash ⇒ Object
22 23 24 |
# File 'lib/dnsync/answer.rb', line 22 def hash [ content, priority ].hash end |