class Matchd::Response
Constants
- NotImplementedError
Attributes
resource_options[R]
Public Class Methods
new(options)
click to toggle source
@param [Hash] options (Mind the string keys!) @option options [Numeric] “ttl” The Time-To-Live of the record (default: `Async::DNS::Transaction::DEFAULT_TTL` = 86400sec = 24h) @option options [String] “name” The absolute DNS name. Default is the question name. @option options [String] “section” The answer section. One of “answer”, “additional”, “authority” (default: “answer”)
# File lib/matchd/response.rb, line 19 def initialize(options) @resource_options = {} return unless options.is_a?(Hash) @resource_options[:ttl] = options["ttl"] if options.key?("ttl") @resource_options[:name] = options["name"] if options.key?("name") @resource_options[:section] = options["section"] if options.key?("section") end
Public Instance Methods
call(transaction)
click to toggle source
# File lib/matchd/response.rb, line 35 def call(transaction) transaction.add([resource], resource_options) end
resource()
click to toggle source
# File lib/matchd/response.rb, line 31 def resource raise NotImplementedError end
valid?()
click to toggle source
# File lib/matchd/response.rb, line 39 def valid? # TODO: this needs to be more suffisticated resource && true rescue ArgumentError false end