Sha256: 1071bd9f98337346e48f405823b6d6f35077981e9e22e4ae16cd1f48cf1a83fe

Contents?: true

Size: 475 Bytes

Versions: 3

Compression:

Stored size: 475 Bytes

Contents

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

# 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.properties[k]}"
  end

  EM.stop
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
em-whois-0.3.0 examples/async_whois.rb
em-whois-0.2.0 examples/async_whois.rb
em-whois-0.1.1 examples/async_whois.rb