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