Converted a very short bash script to rb for readability