Class: Nanook::WorkPeer
- Inherits:
-
Object
- Object
- Nanook::WorkPeer
- Defined in:
- lib/nanook/work_peer.rb
Overview
The Nanook::WorkPeer
class lets you manage your node's work peers.
Instance Method Summary collapse
- #add(address:, port:) ⇒ Object
- #clear ⇒ Object
-
#initialize(rpc) ⇒ WorkPeer
constructor
A new instance of WorkPeer.
- #inspect ⇒ Object
- #list ⇒ Object
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 |
#clear ⇒ Object
14 15 16 |
# File 'lib/nanook/work_peer.rb', line 14 def clear rpc(:work_peers_clear).key?(:success) end |
#inspect ⇒ Object
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 |
#list ⇒ Object
22 23 24 |
# File 'lib/nanook/work_peer.rb', line 22 def list rpc(:work_peers)[:work_peers] end |