Class: DomainSanity::Wildcard

Inherits:
Subject
  • Object
show all
Includes:
RegistrableTypeFacts
Defined in:
lib/domain_sanity/subject.rb

Overview

A "*.something" wildcard name.

Constant Summary

Constants inherited from Subject

Subject::TYPES

Instance Attribute Summary

Attributes inherited from Subject

#input, #policy

Instance Method Summary collapse

Methods included from RegistrableTypeFacts

#type_facts

Methods inherited from Subject

#ascii, for, #hostname?, #initialize, #ip?, #kind, #punycode?, #reasons, #reverse_zone?, #to_h, #type_facts, #unicode, #valid?

Constructor Details

This class inherits a constructor from DomainSanity::Subject

Instance Method Details

#public_suffixObject



174
175
176
# File 'lib/domain_sanity/subject.rb', line 174

def public_suffix
  remainder.psl&.tld
end

#registrable_domainObject

The registrable domain / public suffix of the wildcard's base name.



170
171
172
# File 'lib/domain_sanity/subject.rb', line 170

def registrable_domain
  remainder.psl&.domain
end

#valid_wildcard?Boolean

Baseline-Requirements-valid wildcard. A wildcard is never a plain host name, so #valid? stays false; this is the predicate to ask. Derived from the single normalized remainder, so nothing re-parses.

Returns:

  • (Boolean)


162
163
164
165
166
167
# File 'lib/domain_sanity/subject.rb', line 162

def valid_wildcard?
  return @valid_wildcard if defined?(@valid_wildcard)

  @valid_wildcard = @input.count("*") == 1 &&
    Name.valid_wildcard_remainder?(remainder, policy: @policy)
end

#wildcard?Boolean

Returns:

  • (Boolean)


155
156
157
# File 'lib/domain_sanity/subject.rb', line 155

def wildcard?
  true
end