Sha256: 46345ecea4ae8fa62655abfac2c6df2c1db034b61ddddca68dd00f2233fbc611
Contents?: true
Size: 497 Bytes
Versions: 2
Compression:
Stored size: 497 Bytes
Contents
require 'net/ping' module Janis module Testing def self.connectable?(proxy) host, port = proxy.split(':') return Net::Ping::TCP.new(host, port).ping end def self.filter_results(criteria = [], results) criteria.each do |criterion| # A criterion is a method that returns true or false about a proxy, like #connectable? results.select! { |proxy| Janis::Testing.send(criterion, "#{proxy[:ip]}:#{proxy[:port]}") } end results end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
janis-0.1.4 | lib/janis/testing.rb |
janis-0.1.3 | lib/janis/testing.rb |