Please find attached pdf file for Coding Standards.
Also, refer following git repo for all Ruby idoms: https://github.com/bbatsov/ruby-style-guide
Gem you should consider for refactoring and code formatting:
-
rubocop
-
cane
-
rails_best_practices
For code complexity use flog gem. Refer post [here][1] for more details.
Happy Refactoring :)
[1]: http://knowbuddy.kiprosh-app.com/kyu_entries/ruby-code-quality-metrics-and-security