Class: DnsMock::Record::Builder::Mx
- Includes:
- Error::Helper
- Defined in:
- lib/dns_mock/record/builder/mx.rb
Constant Summary collapse
- MX_RECORD_REGEX_PATTERN =
/\A(.+):(\d+)|(.+)\z/.freeze
- RECORD_PREFERENCE_STEP =
10
Instance Method Summary collapse
Methods included from Error::Helper
#raise_record_context_type_error, #raise_record_type_error
Methods inherited from Base
Constructor Details
This class inherits a constructor from DnsMock::Record::Builder::Base
Instance Method Details
#build ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/dns_mock/record/builder/mx.rb', line 12 def build records_data.map.with_index(1) do |record_data, record_preference| record_data, custom_record_preference = parse_mx_record_data(record_data) target_factory.new( record_data: [ custom_record_preference&.to_i || (record_preference * DnsMock::Record::Builder::Mx::RECORD_PREFERENCE_STEP), record_data ] ).create end end |