Class: CoRE::CoAP::Resolver

Inherits:
Object
  • Object
show all
Defined in:
lib/core/coap/resolver.rb

Class Method Summary collapse

Class Method Details

.address(host) ⇒ Object

Raises:

  • (Resolv::ResolvError)

4
5
6
7
8
9
10
11
12
13
14
# File 'lib/core/coap/resolver.rb', line 4

def self.address(host)
  a = if ENV['IPv4'].nil?
    IPv6FavorResolv.getaddress(host).to_s
  else
    Resolv.getaddress(host).to_s
  end

  raise Resolv::ResolvError if a.empty?

  a
end