refactor code to adhere to @bbhatsov's ruby style guide

* `rubocop —auto-correct`
* some parts of the code dealing with regex were not included because I
wasn’t entirely if Rails would work with it.
Merge pull request #85 from akshatpradhan/rubocop3

refactor code to adhere to @bbhatsov's ruby style guide