Module: DnsMock::Record::Factory

Defined in:
lib/dns_mock/core.rb,
lib/dns_mock/record/factory/a.rb,
lib/dns_mock/record/factory/mx.rb,
lib/dns_mock/record/factory/ns.rb,
lib/dns_mock/record/factory/ptr.rb,
lib/dns_mock/record/factory/soa.rb,
lib/dns_mock/record/factory/srv.rb,
lib/dns_mock/record/factory/txt.rb,
lib/dns_mock/record/factory/aaaa.rb,
lib/dns_mock/record/factory/base.rb,
lib/dns_mock/record/factory/cname.rb

Defined Under Namespace

Classes: Base

Constant Summary collapse

A =
::Class.new(DnsMock::Record::Factory::Base) do
  record_type :a

  def instance_params
    record_data
  end
end
Mx =
::Class.new(DnsMock::Record::Factory::Base) do
  record_type :mx

  def instance_params
    [record_data.first, create_dns_name(record_data.last)]
  end
end
Ns =
::Class.new(DnsMock::Record::Factory::Base) do
  record_type :ns

  def instance_params
    [create_dns_name(record_data)]
  end
end
Ptr =
::Class.new(DnsMock::Record::Factory::Base) do
  record_type :ptr

  def instance_params
    [create_dns_name(record_data)]
  end
end
Soa =
::Class.new(DnsMock::Record::Factory::Base) do
  record_type :soa

  def instance_params
    record_data[0..1].map(&method(:create_dns_name)) + record_data[2..-1]
  end
end
Srv =
::Class.new(DnsMock::Record::Factory::Base) do
  record_type :srv

  def instance_params
    record_data[0..-2] << create_dns_name(record_data.last)
  end
end
Txt =
::Class.new(DnsMock::Record::Factory::Base) do
  record_type :txt

  def instance_params
    record_data
  end
end
Aaaa =
::Class.new(DnsMock::Record::Factory::Base) do
  record_type :aaaa

  def instance_params
    record_data
  end
end
Cname =
::Class.new(DnsMock::Record::Factory::Base) do
  record_type :cname

  def instance_params
    [create_dns_name(record_data)]
  end
end