Class: Glare::DnsRecord

Inherits:
Object
  • Object
show all
Includes:
Comparable
Defined in:
lib/glare/dns_record.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name:, type:, content:) ⇒ DnsRecord

Returns a new instance of DnsRecord.



5
6
7
8
9
# File 'lib/glare/dns_record.rb', line 5

def initialize(name:, type:, content:)
  @name = name
  @type = type
  @content = content
end

Instance Attribute Details

#contentObject (readonly)

Returns the value of attribute content.



25
26
27
# File 'lib/glare/dns_record.rb', line 25

def content
  @content
end

#nameObject (readonly)

Returns the value of attribute name.



25
26
27
# File 'lib/glare/dns_record.rb', line 25

def name
  @name
end

#typeObject (readonly)

Returns the value of attribute type.



25
26
27
# File 'lib/glare/dns_record.rb', line 25

def type
  @type
end

Instance Method Details

#<=>(dns_record) ⇒ Object



19
20
21
22
23
# File 'lib/glare/dns_record.rb', line 19

def <=>(dns_record)
  @type <=> dns_record.type &&
    @name <=> dns_record.name &&
    @content <=> dns_record.content
end

#to_hObject



11
12
13
14
15
16
17
# File 'lib/glare/dns_record.rb', line 11

def to_h
  {
    type: @type,
    name: @name,
    content: @content
  }
end