Converted python to ruby

Converted a few of the conversions that were made in python to ruby.