Class: MonoVM::Whois::Registry::Sources::Base
- Inherits:
-
Object
- Object
- MonoVM::Whois::Registry::Sources::Base
- Defined in:
- lib/monovm/whois/registry/sources/base.rb
Overview
Interface for anything that can supply TLD definitions.
MonoVM::Whois::Registry::ServerRegistry depends on this, not on files: that is what lets a host application feed definitions from a database, an internal HTTP service or a hard-coded hash in a test, without the registry knowing. A source needs two methods, #name and #load.
Direct Known Subclasses
Instance Method Summary collapse
-
#load ⇒ Hash{String => Definition}
Keyed by TLD, with the leading dot.
-
#name ⇒ String
A short identifier recorded in Definition#sources, so a surprising endpoint can be traced back to whichever source supplied it.
-
#optional? ⇒ Boolean
Sources that cannot be read are usually optional (an override file that does not exist yet).
Instance Method Details
#load ⇒ Hash{String => Definition}
Returns keyed by TLD, with the leading dot.
26 27 28 |
# File 'lib/monovm/whois/registry/sources/base.rb', line 26 def load raise NotImplementedError, "#{self.class} must implement #load" end |
#name ⇒ String
A short identifier recorded in Definition#sources, so a surprising endpoint can be traced back to whichever source supplied it.
21 22 23 |
# File 'lib/monovm/whois/registry/sources/base.rb', line 21 def name self.class.name.to_s.split("::").last.gsub(/([a-z])([A-Z])/, '\1_\2').downcase end |
#optional? ⇒ Boolean
Sources that cannot be read are usually optional (an override file that does not exist yet). Returning true here lets MonoVM::Whois::Registry::ServerRegistry skip a failure instead of aborting every lookup.
33 34 35 |
# File 'lib/monovm/whois/registry/sources/base.rb', line 33 def optional? false end |