Method: Net::DNS::Resolver::DnsTimeout#timeout

Defined in:
lib/net/dns/resolver/timeouts.rb

#timeout(&block) ⇒ Object

Executes the method’s block. If the block execution terminates before sec seconds has passed, it returns true. If not, it terminates the execution and raises Timeout::Error. If @seconds is 0 or nil, no timeout is set.

Raises:

  • (LocalJumpError)


29
30
31
32
33
# File 'lib/net/dns/resolver/timeouts.rb', line 29

def timeout(&block)
  raise LocalJumpError, "no block given" unless block_given?

  Timeout.timeout(@seconds, &block)
end