module Tor::Builder
Public Instance Methods
[](key)
click to toggle source
Calls superclass method
# File lib/rest_tor/tor.rb, line 183 def [](key) if value=super(key) Instance.new key, safe_value(value) end end
all()
click to toggle source
Calls superclass method
# File lib/rest_tor/tor.rb, line 189 def all super.reduce({}) { |h, (k, v)| h[k] = Tor::Instance.new(k, safe_value(v)); h } end
insert(port, ip)
click to toggle source
# File lib/rest_tor/tor.rb, line 193 def insert(port, ip) self[port] = { ip: ip } self[port] end
Private Instance Methods
safe_value(value)
click to toggle source
# File lib/rest_tor/tor.rb, line 199 def safe_value(value) counter = value.try(:[], :counter) || {} value.slice(*[:ip, :using, :created_at]).merge({ counter: counter.slice(*[:success, :fail, :success_at, :fail_at, :errors]) }) rescue NoMethodError => e value end