Class: Nanook::WorkPeer
- Inherits:
-
Object
- Object
- Nanook::WorkPeer
- Defined in:
- lib/nanook/work_peer.rb
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.
4 5 6 |
# File 'lib/nanook/work_peer.rb', line 4 def initialize(rpc) @rpc = rpc end |
Instance Method Details
#add(address:, port:) ⇒ Object
8 9 10 |
# File 'lib/nanook/work_peer.rb', line 8 def add(address:, port:) rpc(:work_peer_add, address: address, port: port).has_key?(:success) end |
#clear ⇒ Object
12 13 14 |
# File 'lib/nanook/work_peer.rb', line 12 def clear rpc(:work_peers_clear).has_key?(:success) end |
#inspect ⇒ Object
16 17 18 |
# File 'lib/nanook/work_peer.rb', line 16 def inspect "#{self.class.name}(object_id: \"#{"0x00%x" % (object_id << 1)}\")" end |
#list ⇒ Object
20 21 22 |
# File 'lib/nanook/work_peer.rb', line 20 def list rpc(:work_peers)[:work_peers] end |