From 39fcf081c1d2af07f69270eaabe13a3e3043ad48 Mon Sep 17 00:00:00 2001
From: Jeffrey Phillips Freeman <jeffrey.freeman@syncleus.com>
Date: Tue, 4 Oct 2016 13:25:45 -0400
Subject: [PATCH] Added the ability for the serial port to write both strings
 and byte arrays.

---
 CHANGELOG.md            | 1 +
 lib/kiss/kiss_serial.rb | 4 +++-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index c5b8129..336be34 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -3,6 +3,7 @@
 ## 1.0.2
 
 * Fixed a bug where bytes were not written to the serial stream correctly.
+* Now correctly handles writing both byte arrays and strings to the serial port.
 
 ## 1.0.1
 
diff --git a/lib/kiss/kiss_serial.rb b/lib/kiss/kiss_serial.rb
index b2bf230..6a92645 100644
--- a/lib/kiss/kiss_serial.rb
+++ b/lib/kiss/kiss_serial.rb
@@ -39,7 +39,9 @@ module Kiss
 
         protected
         def write_interface(data)
-            data = data.map { |b| b.chr }.join
+            unless data.is_a? String
+                data = data.map { |b| b.chr }.join
+            end
             @serial.write(data)
         end
 
-- 
GitLab