Class: Ciri::DevP2P::Protocol
- Inherits:
-
Object
- Object
- Ciri::DevP2P::Protocol
- Defined in:
- lib/ciri/devp2p/protocol.rb
Overview
protocol represent DevP2P sub protocols
Instance Attribute Summary collapse
-
#length ⇒ Object
readonly
Returns the value of attribute length.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#node_info ⇒ Object
Returns the value of attribute node_info.
-
#peer_info ⇒ Object
Returns the value of attribute peer_info.
-
#version ⇒ Object
readonly
Returns the value of attribute version.
Instance Method Summary collapse
-
#initialize(name:, version:, length:) ⇒ Protocol
constructor
A new instance of Protocol.
- #start(peer, io) ⇒ Object
- #start=(start_proc) ⇒ Object
Constructor Details
#initialize(name:, version:, length:) ⇒ Protocol
28 29 30 31 32 33 |
# File 'lib/ciri/devp2p/protocol.rb', line 28 def initialize(name:, version:, length:) @name = name @version = version @length = length @start = nil end |
Instance Attribute Details
#length ⇒ Object (readonly)
Returns the value of attribute length.
25 26 27 |
# File 'lib/ciri/devp2p/protocol.rb', line 25 def length @length end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
25 26 27 |
# File 'lib/ciri/devp2p/protocol.rb', line 25 def name @name end |
#node_info ⇒ Object
Returns the value of attribute node_info.
26 27 28 |
# File 'lib/ciri/devp2p/protocol.rb', line 26 def node_info @node_info end |
#peer_info ⇒ Object
Returns the value of attribute peer_info.
26 27 28 |
# File 'lib/ciri/devp2p/protocol.rb', line 26 def peer_info @peer_info end |
#version ⇒ Object (readonly)
Returns the value of attribute version.
25 26 27 |
# File 'lib/ciri/devp2p/protocol.rb', line 25 def version @version end |
Instance Method Details
#start(peer, io) ⇒ Object
39 40 41 42 |
# File 'lib/ciri/devp2p/protocol.rb', line 39 def start(peer, io) raise NotImplementedError.new('not set protocol start proc') unless @start @start.call(peer, io) end |
#start=(start_proc) ⇒ Object
35 36 37 |
# File 'lib/ciri/devp2p/protocol.rb', line 35 def start=(start_proc) @start = start_proc end |