Class: Fixnum
- Inherits:
-
Object
- Object
- Fixnum
- Defined in:
- lib/interlnk/channel/serial.rb
Overview
SerialChannel - low level communications routines for serial channels, used by Protocol
Instance Method Summary collapse
Instance Method Details
#invert_bits(width:) ⇒ Object
4 5 6 7 |
# File 'lib/interlnk/channel/serial.rb', line 4 def invert_bits(width:) # TODO: figure out doing this with math instead of strings self.to_s(2).rjust(width, '0').gsub(/[01]/, {'0' => '1', '1' => '0'}).to_i(2) end |