Class: Nanook::WorkPeer

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

Overview

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

Constant Summary

Constants included from Util

Util::STEP

Instance Method Summary collapse

Constructor Details

#initialize(rpc) ⇒ WorkPeer

Returns a new instance of WorkPeer.



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

def initialize(rpc)
  @rpc = rpc
end

Instance Method Details

#add(address:, port:) ⇒ Object



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

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

#clearObject



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

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

#listObject



28
29
30
# File 'lib/nanook/work_peer.rb', line 28

def list
  rpc(:work_peers, _access: :work_peers, _coerce: Array)
end

#to_sString Also known as: inspect

Returns:

  • (String)


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

def to_s
  self.class.name
end