Class: MonoVM::Whois::Availability::Rules::TldSpecific

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

Overview

Per-TLD availability wording.

Runs late because several entries are single words — .it answers a free name with little more than "available", .ch with "we do not have an entry in our database matching your query". As a general rule those would be far too loose; scoped to one registry's output format they are reliable.

By the time the chain gets here, every rule that could establish a registration has already declined, so a loose availability pattern can only fire on a response that carried no registration signal at all.

Instance Method Summary collapse

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

#name

Instance Method Details

#call(context) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/monovm/whois/availability/rules/tld_specific.rb', line 20

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

  patterns = Patterns::TLD_AVAILABILITY[context.tld]
  return nil if patterns.nil?

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

  available(
    reason: "matched an availability pattern specific to #{context.tld}",
    evidence: matched
  )
end