Clean up ruby code

Introduces rubocop, make it a mandatory part to pass the tests and fix
all offenses. The trailing comma detection is a bit weird, but having an
automatic linter/style checker should help to keep the code base clean.