Sha256: 0ddd2ae1d4a551f574e21b183e49eff11b00152732d9632b1b30f8caef1643db

Contents?: true

Size: 733 Bytes

Versions: 1

Compression:

Stored size: 733 Bytes

Contents

class Matchd::Rule::Append < Matchd::Rule
  def initialize(options)
    super
    opts = options.fetch("append_question")

    if opts.is_a?(Hash)
      @append_questions = Array(opts.fetch("resource_class"))
      @transaction_options = Matchd::Helpers.extract_options(%w(ttl name section), opts)
    else
      @append_questions = Array(opts)
      @transaction_options = {}
    end
  end

  attr_reader :append_questions, :transaction_options

  def visit!(_server, _name, _resource_class, transaction)
    transaction.append_question!
    Matchd::Rule.parse_resource_class(append_questions).each do |append_resource_class|
      transaction.append!(transaction.name, append_resource_class, transaction_options)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
matchd-0.1.0 lib/matchd/rule/append.rb