Add ruby version.
Refactor spec.
Remove running code.
Use each with object.
Use named capture.
Use map.
Remove useless '+1'.
Use map & compact.
Refactor to be more OOP style.
Remove useless +.
Divide lines.
Use if instead of unless.
Refactor to be more readable.
Use select.
Remove unused variable.
Encapsulate sort rule.
Use any.
Use +=.
Use select.
Encapsulate logic.