Class: DEVp2p::PeerErrors
- Inherits:
-
PeerErrorsBase
- Object
- PeerErrorsBase
- DEVp2p::PeerErrors
- Defined in:
- lib/devp2p/peer_errors.rb
Instance Method Summary collapse
- #add(address, error, client_version = '') ⇒ Object
-
#initialize ⇒ PeerErrors
constructor
A new instance of PeerErrors.
Constructor Details
#initialize ⇒ PeerErrors
15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/devp2p/peer_errors.rb', line 15 def initialize @errors = Hash.new {|h, k| h[k] = [] } # node:['error'] @client_versions = {} # address: client_version at_exit do @errors.each do |k, v| puts "#{k} #{@client_versions.fetch(k, '')}" puts v.join("\t") end end end |
Instance Method Details
#add(address, error, client_version = '') ⇒ Object
27 28 29 30 |
# File 'lib/devp2p/peer_errors.rb', line 27 def add(address, error, client_version='') @errors[address].push error @client_versions[address] = client_version unless client_version.nil? || client_version.empty? end |