Class: HTTPX::Resolver::System

Inherits:
Object
  • Object
show all
Includes:
ResolverMixin
Defined in:
lib/httpx/resolver/system.rb

Constant Summary

Constants included from ResolverMixin

ResolverMixin::CHECK_IF_IP

Constants included from Loggable

Loggable::COLORS

Instance Method Summary collapse

Methods included from Loggable

#log

Methods included from Callbacks

#emit, #on, #once

Constructor Details

#initialize(_, options) ⇒ System

Returns a new instance of System.



10
11
12
13
14
15
16
# File 'lib/httpx/resolver/system.rb', line 10

def initialize(_, options)
  @options = Options.new(options)
  roptions = @options.resolver_options
  @state = :idle
  @resolver = Resolv::DNS.new(roptions.nil? ? nil : roptions)
  @resolver.timeouts = roptions[:timeouts] if roptions
end

Instance Method Details

#<<(channel) ⇒ Object



26
27
28
29
30
# File 'lib/httpx/resolver/system.rb', line 26

def <<(channel)
  hostname = channel.uri.host
  addresses = ip_resolve(hostname) || system_resolve(hostname) || @resolver.getaddresses(hostname)
  addresses.empty? ? emit_resolve_error(channel, hostname) : emit_addresses(channel, addresses)
end

#closed?Boolean

Returns:

  • (Boolean)


18
19
20
# File 'lib/httpx/resolver/system.rb', line 18

def closed?
  true
end

#empty?Boolean

Returns:

  • (Boolean)


22
23
24
# File 'lib/httpx/resolver/system.rb', line 22

def empty?
  true
end

#uncacheObject



32
# File 'lib/httpx/resolver/system.rb', line 32

def uncache(*); end