class Proxtopus::ProxySet
Public Instance Methods
include?(proxy)
click to toggle source
# File lib/proxtopus/proxy_set.rb, line 39 def include?(proxy) if proxy.is_a?(Proxtopus::Proxy) each do |p| return true if proxy == p end false else false end end
push(proxy)
click to toggle source
Calls superclass method
# File lib/proxtopus/proxy_set.rb, line 4 def push(proxy) #puts proxy.class if !proxy.is_a?(Proxtopus::Proxy) && !proxy.is_a?(Proxtopus::ProxySet) && !proxy.is_a?(Hash) raise ArgumentError, "A ProxySet may only contain Proxy, ProxySet, or Hash objects!" end if !proxy.is_a?(Proxtopus::ProxySet) if proxy.is_a?(Hash) proxy = Proxy.new(proxy['host'], proxy['port'], proxy['protocol'], proxy['country'], proxy['anonymity']) end super(proxy) if !include?(proxy) else proxy.each { |p| super(p) } end self end
shift(proxy)
click to toggle source
Calls superclass method
# File lib/proxtopus/proxy_set.rb, line 22 def shift(proxy) if !proxy.is_a?(Proxtopus::Proxy) && !proxy.is_a?(Hash) raise ArgumentError, "A ProxySet may only contain Proxy or Hash objects!" end if !proxy.is_a?(Proxtopus::ProxySet) if proxy.is_a?(Hash) proxy = Proxy.new(proxy['host'], proxy['port'], proxy['protocol'], proxy['country'], proxy['anonymity']) end super(proxy) if !include?(proxy) else proxy.each { |p| super(p) } end self end