lib/dbee/query/sorter.rb in dbee-1.0.1 vs lib/dbee/query/sorter.rb in dbee-1.0.2

- old
+ new

@@ -5,12 +5,10 @@ # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. # -require_relative 'key_path' - module Dbee class Query # Abstract representation of the ORDER BY part of a SQL statement. class Sorter acts_as_hashable @@ -46,8 +44,12 @@ def ==(other) other.key_path == key_path && other.direction == direction end alias eql? == + + def <=>(other) + "#{key_path}#{direction}" <=> "#{other.key_path}#{other.direction}" + end end end end