Class: Ciri::P2P::NodeID
- Inherits:
-
Object
- Object
- Ciri::P2P::NodeID
- Defined in:
- lib/ciri/p2p/node.rb
Overview
present node id
Instance Attribute Summary collapse
-
#public_key ⇒ Object
(also: #key)
readonly
Returns the value of attribute public_key.
Class Method Summary collapse
Instance Method Summary collapse
- #==(other) ⇒ Object
- #id ⇒ Object (also: #to_bytes)
-
#initialize(public_key) ⇒ NodeID
constructor
A new instance of NodeID.
- #short_hex ⇒ Object
- #to_hex ⇒ Object (also: #to_s)
Constructor Details
Instance Attribute Details
#public_key ⇒ Object (readonly) Also known as: key
Returns the value of attribute public_key.
39 40 41 |
# File 'lib/ciri/p2p/node.rb', line 39 def public_key @public_key end |
Class Method Details
Instance Method Details
#==(other) ⇒ Object
56 57 58 |
# File 'lib/ciri/p2p/node.rb', line 56 def == (other) self.class == other.class && id == other.id end |
#id ⇒ Object Also known as: to_bytes
50 51 52 |
# File 'lib/ciri/p2p/node.rb', line 50 def id @id ||= key.raw_public_key[1..-1] end |
#short_hex ⇒ Object
66 67 68 |
# File 'lib/ciri/p2p/node.rb', line 66 def short_hex @short_hex ||= to_hex[0..8] end |
#to_hex ⇒ Object Also known as: to_s
60 61 62 |
# File 'lib/ciri/p2p/node.rb', line 60 def to_hex Ciri::Utils.to_hex id end |