Class: MonoVM::Whois::Availability::Rules::NoMatch

Inherits:
MonoVM::Whois::Availability::Rule show all
Defined in:
lib/monovm/whois/availability/rules/no_match.rb

Overview

The regexp form of the not-found phrases.

Overlaps AvailabilityKeywords on purpose. That rule does a fast substring scan, which misses a registry that writes No match with two spaces or not\tfound with a tab; these patterns are whitespace-tolerant and catch the rest. Cheap check first, thorough check second.

Instance Method Summary collapse

Methods inherited from MonoVM::Whois::Availability::Rule

#name

Instance Method Details

#call(context) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
# File 'lib/monovm/whois/availability/rules/no_match.rb', line 16

def call(context)
  return nil if context.empty?

  matched = context.find(Patterns::NO_MATCH, source: :significant)
  return nil if matched.nil?

  available(
    reason: "the response matched a not-found pattern",
    evidence: matched
  )
end