On Fri, Dec 01, 2006 at 12:20:36AM +0900, Daniel Berger wrote:
[snip]
> >I'm aware of those but they lack some features the Perl version has. 
> >Notably
> >ICMP support and returning timing information.
> >  
> Well, there is PingExternal for ICMP support. ;)
> 
> Seriously, though, both would be good additions.

Indeed.

> >It would also be nice for there to be a single Net::Ping class, just like 
> >the
> >Perl version provides, wrapping/hiding the specialized classes. That seems
> >like an easy addition.
> >  
> The API was modelled after the current ping.rb in the standard library 
> to try to keep things consistant and more portable for anyone switching 
> from ping.rb to my net-ping module.  A factory pattern should be doable 
> if that's what folks want.  In practice, however, I don't see it as a 
> major issue, and probably not worth the API breakage.

It eases the transition from Perl, as in my case. If you mean something like
the following then that would be great:

    lizzy:/tmp% cat r
    class Ping
      def self.create(type, *args)
	case type
	when :foo
	  FooPing.new
	when :bar
	  BarPing.new
	end
      end
    end

    class FooPing < Ping
      def ping(host)
	puts "#{self.class}: pinging #{host}"
      end
    end

    class BarPing < Ping
      def ping(host)
	puts "#{self.class}: pinging #{host}"
      end
    end

    pinger = Ping.create(:bar)
    pinger.ping("myhost")
    lizzy:/tmp% ruby r
    BarPing: pinging myhost
    lizzy:/tmp% 

Let me know what I can do to help move this along.

-- 
Jos Backus
jos at catnook.com