Issue 1227 - Conflicts Solved

Updated  @xiangyu89's PR to allow for a painless merge with the master branch.
`end` at 91, 47 is not aligned with `items = items` at 89, 8 or `.sort { |a, b| hash[:sorts][sort_by]` at 90, 18<br>Space missing after comma.