Class: Rustle::DebugPort

Inherits:
Object
  • Object
show all
Defined in:
lib/rustle/debug_port.rb

Overview

DebugPort

This class’s purpose is simply to provide a mock serial port for debugging purposes. Instead of writing to an actual TTY connection, it simply deserializes and returns the values passed into it. It’s convenient because it allows one to test without requiring a physical Arduino.

Instance Method Summary collapse

Instance Method Details

#write(string) ⇒ Array<Fixnum>

Returns an array containing the deserialized values found in string.

Parameters:

  • string (String)

    the string of chars to be written to the mock serial port

Returns:

  • (Array<Fixnum>)

    an array containing the deserialized values found in string



14
15
16
# File 'lib/rustle/debug_port.rb', line 14

def write(string)
  string.chars.map(&:ord)
end