Method: Modbus::ProtocolData#shift_word
- Defined in:
- lib/modbus/connection/protocol_data.rb
#shift_word ⇒ Integer, NilClass
Shifts two bytes off the from front of the array and interprets them as a word (network byte order).
31 32 33 34 35 |
# File 'lib/modbus/connection/protocol_data.rb', line 31 def shift_word return nil if size < 2 # self.shift(2).pack('C2').unpack('n').first self.slice!(0,2).pack('C2').unpack('n').first end |