Class: Dnsync::Record
- Inherits:
-
Object
- Object
- Dnsync::Record
- Includes:
- Comparable
- Defined in:
- lib/dnsync/record.rb
Instance Attribute Summary collapse
-
#answers ⇒ Object
readonly
Returns the value of attribute answers.
-
#identifier ⇒ Object
readonly
Returns the value of attribute identifier.
-
#ttl ⇒ Object
readonly
Returns the value of attribute ttl.
Instance Method Summary collapse
- #<=>(other) ⇒ Object
- #hash ⇒ Object
-
#initialize(name, type, ttl, answers) ⇒ Record
constructor
A new instance of Record.
- #name ⇒ Object
- #type ⇒ Object
Constructor Details
#initialize(name, type, ttl, answers) ⇒ Record
Returns a new instance of Record.
12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/dnsync/record.rb', line 12 def initialize(name, type, ttl, answers) unless ttl.present? raise ArgumentError, 'ttl must be provided' end @identifier = RecordIdentifier.new(name, type) @ttl = ttl @answers = answers.sort freeze end |
Instance Attribute Details
#answers ⇒ Object (readonly)
Returns the value of attribute answers.
10 11 12 |
# File 'lib/dnsync/record.rb', line 10 def answers @answers end |
#identifier ⇒ Object (readonly)
Returns the value of attribute identifier.
10 11 12 |
# File 'lib/dnsync/record.rb', line 10 def identifier @identifier end |
#ttl ⇒ Object (readonly)
Returns the value of attribute ttl.
10 11 12 |
# File 'lib/dnsync/record.rb', line 10 def ttl @ttl end |
Instance Method Details
#<=>(other) ⇒ Object
32 33 34 |
# File 'lib/dnsync/record.rb', line 32 def <=>(other) [ identifier, ttl, answers ] <=> [ other.identifier, other.ttl, other.answers ] end |
#hash ⇒ Object
36 37 38 |
# File 'lib/dnsync/record.rb', line 36 def hash [ identifier, ttl, answers ].hash end |
#name ⇒ Object
24 25 26 |
# File 'lib/dnsync/record.rb', line 24 def name @identifier.name end |
#type ⇒ Object
28 29 30 |
# File 'lib/dnsync/record.rb', line 28 def type @identifier.type end |