Class: Paleth::Net

Inherits:
Object
  • Object
show all
Includes:
Liar
Defined in:
lib/paleth/net.rb

Overview

Provide some data about the underlying network status

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Liar

#make_promise

Constructor Details

#initialize(core) ⇒ Net

:nodoc:


12
13
14
# File 'lib/paleth/net.rb', line 12

def initialize(core)
  @core = core
end

Instance Attribute Details

#coreObject (readonly)

:nodoc:


9
10
11
# File 'lib/paleth/net.rb', line 9

def core
  @core
end

Instance Method Details

#listeningObject

Returns a Promise resolving to true or false whether the client is listening for connections


18
19
20
# File 'lib/paleth/net.rb', line 18

def listening
  make_promise(@core.web3.JS[:net], 'getListening')
end

#peer_countObject

Returns a Promise resolving to the current peer count


23
24
25
# File 'lib/paleth/net.rb', line 23

def peer_count
  make_promise(@core.web3.JS[:net], 'getPeerCount')
end