Class: Dnsync::RecordIdentifier

Inherits:
Object
  • Object
show all
Includes:
Comparable
Defined in:
lib/dnsync/record_identifier.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#nameObject (readonly)

Returns the value of attribute name.



7
8
9
# File 'lib/dnsync/record_identifier.rb', line 7

def name
  @name
end

#typeObject (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

#hashObject



28
29
30
# File 'lib/dnsync/record_identifier.rb', line 28

def hash
  [ name, type ].hash
end