Sha256: d0a59264dcdc1d254c6bf0b2a6c14a1bdd3c9823c63310237b38ff4959e77d6f
Contents?: true
Size: 1.13 KB
Versions: 3
Compression:
Stored size: 1.13 KB
Contents
class Nanook class Node def initialize(rpc) @rpc = rpc end def block_count rpc(:block_count) end def block_count_type rpc(:block_count_type) end def bootstrap(address:, port:) rpc(:bootstrap, address: address, port: port).has_key?(:success) end def bootstrap_any rpc(:bootstrap_any).has_key?(:success) end def frontier_count rpc(:frontier_count)[:count] end def inspect # :nodoc: "#{self.class.name}(object_id: \"#{"0x00%x" % (object_id << 1)}\")" end def peers rpc(:peers)[:peers] end def representatives rpc(:representatives)[:representatives] end def stop rpc(:stop).has_key?(:success) end def sync_progress response = rpc(:block_count) count = response[:count] unchecked = response[:unchecked] total = count + unchecked count.to_f * 100 / total.to_f end def synced? rpc(:block_count)[:unchecked] == 0 end def version rpc(:version) end private def rpc(action, params={}) @rpc.call(action, params) end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
nanook-1.0.2 | lib/nanook/node.rb |
nanook-1.0.1 | lib/nanook/node.rb |
nanook-1.0.0 | lib/nanook/node.rb |