class ProxySeeker::Proxy
Attributes
ip[R]
latency[R]
opts[R]
port[R]
Public Class Methods
new(ip, port, opts = {})
click to toggle source
# File lib/proxy_seeker/proxy.rb, line 9 def initialize(ip, port, opts = {}) @ip = ip @port = port.to_i @latency = opts[:latency] end
Public Instance Methods
<=>(other)
click to toggle source
# File lib/proxy_seeker/proxy.rb, line 23 def <=>(other) return 0 if latency.nil? && other.latency.nil? return 1 if latency.nil? && !other.latency.nil? return -1 if !latency.nil? && other.latency.nil? latency <=> other.latency end
to_s()
click to toggle source
# File lib/proxy_seeker/proxy.rb, line 15 def to_s "#{ip}:#{port}" end
valid?()
click to toggle source
# File lib/proxy_seeker/proxy.rb, line 19 def valid? ip =~ Resolv::IPv4::Regex && port.to_i > 0 ? true : false end