Class: Matchd::Rule::Fail

Inherits:
Matchd::Rule show all
Defined in:
lib/matchd/rule/fail.rb

Constant Summary

Constants inherited from Matchd::Rule

NotImplementedError, REGEXP_MATCHER, REGEXP_OPTIONS

Instance Attribute Summary

Attributes inherited from Matchd::Rule

#raw

Instance Method Summary collapse

Methods inherited from Matchd::Rule

#call, #match_name, #match_resource_classes, #matches?, parse_match, parse_resource_class

Constructor Details

#initialize(options) ⇒ Fail

Returns a new instance of Fail.



2
3
4
5
# File 'lib/matchd/rule/fail.rb', line 2

def initialize(options)
  super
  @fail = options.fetch("fail")
end

Instance Method Details

#rcodeObject



11
12
13
14
15
16
17
# File 'lib/matchd/rule/fail.rb', line 11

def rcode
  @rcode ||=
    case @fail
    when Symbol, String then Resolv::DNS::RCode.const_get(@fail)
    else @fail
    end
end

#visit!(_server, _name, _resource_class, transaction) ⇒ Object



7
8
9
# File 'lib/matchd/rule/fail.rb', line 7

def visit!(_server, _name, _resource_class, transaction)
  transaction.fail!(rcode)
end