Class: Nanook::WorkPeer

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

Instance Method Summary collapse

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

#clearObject


12
13
14
# File 'lib/nanook/work_peer.rb', line 12

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

#inspectObject


16
17
18
# File 'lib/nanook/work_peer.rb', line 16

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

#listObject


20
21
22
# File 'lib/nanook/work_peer.rb', line 20

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