Class: Pio::SendOutPort
- Inherits:
-
Object
- Object
- Pio::SendOutPort
- Extended by:
- Forwardable
- Defined in:
- lib/pio/send_out_port.rb
Overview
An action to output a packet to a port.
Defined Under Namespace
Classes: Format
Class Method Summary collapse
Instance Method Summary collapse
-
#==(other) ⇒ Object
rubocop:enable MethodLength.
-
#initialize(user_options) ⇒ SendOutPort
constructor
Creates an action to output a packet to a port.
Constructor Details
#initialize(user_options) ⇒ SendOutPort
Creates an action to output a packet to a port.
rubocop:disable MethodLength
59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/pio/send_out_port.rb', line 59 def initialize() = if .respond_to?(:to_i) { port_number: .to_i } elsif PortNumber::NUMBERS.key?() { port_number: } else end max_len = [:max_len] if max_len && !max_len.unsigned_16bit? fail ArgumentError, 'The max_len should be an unsigned 16bit integer.' end @format = Format.new() end |
Class Method Details
.read(raw_data) ⇒ Object
19 20 21 22 23 |
# File 'lib/pio/send_out_port.rb', line 19 def self.read(raw_data) send_out_port = allocate send_out_port.instance_variable_set :@format, Format.read(raw_data) send_out_port end |
Instance Method Details
#==(other) ⇒ Object
rubocop:enable MethodLength
75 76 77 78 |
# File 'lib/pio/send_out_port.rb', line 75 def ==(other) return false unless other to_binary == other.to_binary end |