Method: Async::DNS::Transaction#respond!

Defined in:
lib/async/dns/transaction.rb

#respond!(*args) ⇒ Object

The last argument can optionally be a hash of ‘options`. If `options` is provided, it overrides the default resource class of transaction. Additional `options` are passed to #append!.

See ‘Resolv::DNS::Resource` for more information about the various `resource_classes` available (www.ruby-doc.org/stdlib/libdoc/resolv/rdoc/index.html).



119
120
121
122
123
124
125
126
127
128
129
130
131
132
# File 'lib/async/dns/transaction.rb', line 119

def respond!(*args)
	append_question!
	
	options = args.last.kind_of?(Hash) ? args.pop : {}
	resource_class = options[:resource_class] || @resource_class
	
	if resource_class == nil
		raise ArgumentError.new("Could not instantiate resource #{resource_class}!")
	end
	
	resource = resource_class.new(*args)
	
	add([resource], options)
end