Class: Ciri::P2P::Node
- Inherits:
-
Object
- Object
- Ciri::P2P::Node
- Defined in:
- lib/ciri/p2p/node.rb
Instance Attribute Summary collapse
-
#added_at ⇒ Object
readonly
Returns the value of attribute added_at.
-
#addresses ⇒ Object
Returns the value of attribute addresses.
-
#node_id ⇒ Object
readonly
Returns the value of attribute node_id.
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#initialize(raw_node_id: nil, node_id: raw_node_id && NodeID.from_raw_id(raw_node_id), addresses:, added_at: nil) ⇒ Node
constructor
A new instance of Node.
- #raw_node_id ⇒ Object
Constructor Details
#initialize(raw_node_id: nil, node_id: raw_node_id && NodeID.from_raw_id(raw_node_id), addresses:, added_at: nil) ⇒ Node
Returns a new instance of Node.
76 77 78 79 80 81 82 83 |
# File 'lib/ciri/p2p/node.rb', line 76 def initialize(raw_node_id: nil, node_id: raw_node_id && NodeID.from_raw_id(raw_node_id), addresses:, added_at: nil) @node_id = node_id @addresses = addresses @added_at = added_at end |
Instance Attribute Details
#added_at ⇒ Object (readonly)
Returns the value of attribute added_at.
73 74 75 |
# File 'lib/ciri/p2p/node.rb', line 73 def added_at @added_at end |
#addresses ⇒ Object
Returns the value of attribute addresses.
74 75 76 |
# File 'lib/ciri/p2p/node.rb', line 74 def addresses @addresses end |
#node_id ⇒ Object (readonly)
Returns the value of attribute node_id.
73 74 75 |
# File 'lib/ciri/p2p/node.rb', line 73 def node_id @node_id end |
Instance Method Details
#==(other) ⇒ Object
85 86 87 |
# File 'lib/ciri/p2p/node.rb', line 85 def == (other) self.class == other.class && node_id == other.node_id end |
#raw_node_id ⇒ Object
89 90 91 |
# File 'lib/ciri/p2p/node.rb', line 89 def raw_node_id node_id.to_bytes end |