Sha256: 5ede8bdd08f00bc1a91bcd6685e30531c472ae09dc29072fa8127b8909eafeca

Contents?: true

Size: 517 Bytes

Versions: 7

Compression:

Stored size: 517 Bytes

Contents

class Nanook
  class WorkPeer

    def initialize(rpc)
      @rpc = rpc
    end

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

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

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

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

    private

    def rpc(action, params={})
      @rpc.call(action, params)
    end

  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
nanook-2.5.1 lib/nanook/work_peer.rb
nanook-2.5.0 lib/nanook/work_peer.rb
nanook-2.4.0 lib/nanook/work_peer.rb
nanook-2.3.0 lib/nanook/work_peer.rb
nanook-2.2.0 lib/nanook/work_peer.rb
nanook-2.1.0 lib/nanook/work_peer.rb
nanook-2.0.0 lib/nanook/work_peer.rb