Class: MonoVM::Whois::Registry::Resolution
- Inherits:
-
Object
- Object
- MonoVM::Whois::Registry::Resolution
- Defined in:
- lib/monovm/whois/registry/resolution.rb
Overview
A name split into its registrable parts, with the definition that serves it.
Produced by ServerRegistry#resolve. Exists so the split and the definition
travel together: knowing that example.co.uk has SLD example is only
meaningful alongside the fact that .co.uk is the suffix a registry
actually serves.
Instance Attribute Summary collapse
-
#definition ⇒ Object
readonly
Returns the value of attribute definition.
-
#domain ⇒ Object
readonly
Returns the value of attribute domain.
-
#registrable ⇒ Object
readonly
The registrable name — the SLD plus its suffix, with any subdomain dropped.
-
#sld ⇒ Object
readonly
Returns the value of attribute sld.
-
#tld ⇒ Object
readonly
Returns the value of attribute tld.
Instance Method Summary collapse
-
#initialize(domain:, sld:, tld:, definition:, registrable: nil) ⇒ Resolution
constructor
A new instance of Resolution.
- #inspect ⇒ Object
-
#query ⇒ Object
The ASCII form to put on the wire.
- #to_h ⇒ Object
Constructor Details
#initialize(domain:, sld:, tld:, definition:, registrable: nil) ⇒ Resolution
Returns a new instance of Resolution.
25 26 27 28 29 30 31 32 33 34 |
# File 'lib/monovm/whois/registry/resolution.rb', line 25 def initialize(domain:, sld:, tld:, definition:, registrable: nil) @domain = domain @sld = sld @tld = tld @definition = definition # Built here, not memoised: the instance is frozen, so a lazy ivar would # raise FrozenError on first use. @registrable = registrable || DomainName.parse("#{sld}#{tld}") freeze end |
Instance Attribute Details
#definition ⇒ Object (readonly)
Returns the value of attribute definition.
13 14 15 |
# File 'lib/monovm/whois/registry/resolution.rb', line 13 def definition @definition end |
#domain ⇒ Object (readonly)
Returns the value of attribute domain.
13 14 15 |
# File 'lib/monovm/whois/registry/resolution.rb', line 13 def domain @domain end |
#registrable ⇒ Object (readonly)
The registrable name — the SLD plus its suffix, with any subdomain
dropped. A lookup for www.example.co.uk must query example.co.uk,
because that is the object the registry holds. In Unicode form; call
#query for the wire form.
40 41 42 |
# File 'lib/monovm/whois/registry/resolution.rb', line 40 def registrable @registrable end |
#sld ⇒ Object (readonly)
Returns the value of attribute sld.
13 14 15 |
# File 'lib/monovm/whois/registry/resolution.rb', line 13 def sld @sld end |
#tld ⇒ Object (readonly)
Returns the value of attribute tld.
13 14 15 |
# File 'lib/monovm/whois/registry/resolution.rb', line 13 def tld @tld end |
Instance Method Details
#inspect ⇒ Object
51 52 53 |
# File 'lib/monovm/whois/registry/resolution.rb', line 51 def inspect "#<#{self.class.name} #{sld}|#{tld}>" end |
#query ⇒ Object
The ASCII form to put on the wire.
43 44 45 |
# File 'lib/monovm/whois/registry/resolution.rb', line 43 def query registrable.ascii end |
#to_h ⇒ Object
47 48 49 |
# File 'lib/monovm/whois/registry/resolution.rb', line 47 def to_h { domain: domain.to_s, sld: sld, tld: tld, registrable: registrable.to_s } end |