From f9affe4641d8efa2208d5d54eeea13cac1e04918 Mon Sep 17 00:00:00 2001 From: Marvin Johanning Date: Wed, 11 Jul 2018 14:42:49 +0200 Subject: [PATCH] Change indentation --- src/gmail.rb | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/src/gmail.rb b/src/gmail.rb index 372261f..7663a7a 100644 --- a/src/gmail.rb +++ b/src/gmail.rb @@ -27,7 +27,7 @@ end #Start the bash file, read the file it creates and find out what port the Arduino is connected to system("bash #{File.dirname(__FILE__)}/detect_serial.sh > serial") File.open("#{File.dirname(__FILE__)}/serial").each_line do |line| -@serial_connection = line.slice(0..(line.index(' '))) if line.include?("Arduino") + @serial_connection = line.slice(0..(line.index(' '))) if line.include?("Arduino") end #FileUtils.rm("#{File.dirname(__FILE__)}/src/serial") @@ -69,24 +69,24 @@ wait_time = 4 #for an infinite amount of time loop do -#get the number of unread messages in the inbox -unread = gmail.inbox.count(:unread) + #get the number of unread messages in the inbox + unread = gmail.inbox.count(:unread) -#lets us know that we've checked the unread messages -puts "Checked unread." + #lets us know that we've checked the unread messages + puts "Checked unread." -#check if the number of unread messages has increased -if unread > prev_unread - #Write the subject of the last unread email to the serial port - port.write gmail.inbox.find(:unread).last.subject + #check if the number of unread messages has increased + if unread > prev_unread + #Write the subject of the last unread email to the serial port + port.write gmail.inbox.find(:unread).last.subject - #For debugging purposes - puts "Received email: \n" + gmail.inbox.find(:unread).last.subject -end - -#reset the number of unread emails -prev_unread = unread - -#wait before we make another request to the Gmail servers -sleep wait_time + #For debugging purposes + puts "Received email: \n" + gmail.inbox.find(:unread).last.subject + end + + #reset the number of unread emails + prev_unread = unread + + #wait before we make another request to the Gmail servers + sleep wait_time end