Class: Nanook::WorkPeer

Inherits:
Object
  • Object
show all
Defined in:
lib/nanook/work_peer.rb

Overview

The Nanook::WorkPeer class lets you manage your node's work peers.

Instance Method Summary collapse

Constructor Details

#initialize(rpc) ⇒ WorkPeer

Returns a new instance of WorkPeer.



6
7
8
# File 'lib/nanook/work_peer.rb', line 6

def initialize(rpc)
  @rpc = rpc
end

Instance Method Details

#add(address:, port:) ⇒ Object



10
11
12
# File 'lib/nanook/work_peer.rb', line 10

def add(address:, port:)
  rpc(:work_peer_add, address: address, port: port).key?(:success)
end

#clearObject



14
15
16
# File 'lib/nanook/work_peer.rb', line 14

def clear
  rpc(:work_peers_clear).key?(:success)
end

#inspectObject



18
19
20
# File 'lib/nanook/work_peer.rb', line 18

def inspect
  "#{self.class.name}(object_id: \"#{format('0x00%x', (object_id << 1))}\")"
end

#listObject



22
23
24
# File 'lib/nanook/work_peer.rb', line 22

def list
  rpc(:work_peers)[:work_peers]
end