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, ensure_ends_without_dot, escape, #hash, #key, #log!, long_quote, needs_long_quotes?, quote, #to_hash, #to_json, #to_s, #type, unescape, unlong_quote, unquote, #wildcard?

Constructor Details

#initialize(record) ⇒ MX

Returns a new instance of MX.



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

def initialize(record)
  super
  @exchange = Record.ensure_ends_with_dot(record.fetch(:exchange))
  @preference = Integer(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



22
23
24
25
26
27
# File 'lib/record_store/record/mx.rb', line 22

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

#rdata_txtObject



29
30
31
# File 'lib/record_store/record/mx.rb', line 29

def rdata_txt
  "#{preference} #{exchange}"
end