Sha256: 1d9f72871ab43db5d854e6f256849a02336dc642828c624cda7c01a81e47056c

Contents?: true

Size: 491 Bytes

Versions: 1

Compression:

Stored size: 491 Bytes

Contents

$: << File.dirname(__FILE__) + '/../lib'
require 'em-whois'
require 'whois-parser'

# Asynchronous WHOIS lookup -- em-whois should opt to use EM-based TcpSocket

EM.synchrony do

  # EM pulse
  EM.add_periodic_timer(0.1) do
    STDERR.print "."
  end

  # Async WHOIS lookup
  domain = ARGV[0] || "github.com"

  r = Whois.whois(domain)

  puts "\r#{domain}\n#{"-" * domain.length}"
  [:available?, :status, :expires_on].each do |k|
    puts "#{k}: #{r.parser.send(k)}"
  end

  EM.stop
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
em-whois-0.4.0 examples/async_whois.rb