Class: RecordStore::Record::MX

Inherits:
RecordStore::Record show all
Defined in:
lib/record_store/record/mx.rb

Constant Summary

Constants inherited from RecordStore::Record

CNAME_REGEX, FQDN_REGEX

Instance Attribute Summary collapse

Attributes inherited from RecordStore::Record

#fqdn, #id, #ttl

Instance Method Summary collapse

Methods inherited from RecordStore::Record

#==, build_from_yaml_definition, ensure_ends_with_dot, #hash, #key, #log!, #to_hash, #to_json, #type

Constructor Details

#initialize(record) ⇒ MX

Returns a new instance of MX.



8
9
10
11
12
# File 'lib/record_store/record/mx.rb', line 8

def initialize(record)
  super
  @exchange = Record.ensure_ends_with_dot(record.fetch(:exchange))
  @preference = record.fetch(:preference)
end

Instance Attribute Details

#exchangeObject

Returns the value of attribute exchange.



3
4
5
# File 'lib/record_store/record/mx.rb', line 3

def exchange
  @exchange
end

#preferenceObject

Returns the value of attribute preference.



3
4
5
# File 'lib/record_store/record/mx.rb', line 3

def preference
  @preference
end

Instance Method Details

#rdataObject



14
15
16
17
18
19
# File 'lib/record_store/record/mx.rb', line 14

def rdata
  {
    preference: preference,
    exchange: exchange
  }
end

#to_sObject



21
22
23
# File 'lib/record_store/record/mx.rb', line 21

def to_s
  "[MXRecord] #{fqdn} #{ttl} IN MX #{preference} #{exchange}"
end