Class: Aquatone::Resolver
- Inherits:
-
Object
- Object
- Aquatone::Resolver
- Defined in:
- lib/aquatone/resolver.rb
Constant Summary collapse
- TIMEOUT =
3.freeze
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
-
#initialize(options) ⇒ Resolver
constructor
A new instance of Resolver.
- #resolve(host) ⇒ Object
- #resource(host) ⇒ Object
Constructor Details
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
3 4 5 |
# File 'lib/aquatone/resolver.rb', line 3 def @options end |
Instance Method Details
#resolve(host) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/aquatone/resolver.rb', line 13 def resolve(host) retried = false host = "#{host}." unless host.end_with?(".") return (resolve_with_nameserver(host) || resolve_with_fallback_nameserver(host)) rescue if !retried retried = true retry end nil end |
#resource(host) ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/aquatone/resolver.rb', line 25 def resource(host) resource = resource_with_nameserver(host, Resolv::DNS::Resource::IN::CNAME) || resource_with_fallback_nameserver(host, Resolv::DNS::Resource::IN::CNAME) if !resource resource = resource_with_nameserver(host, Resolv::DNS::Resource::IN::A) || resource_with_fallback_nameserver(host, Resolv::DNS::Resource::IN::A) end resource end |