Sha256: 0617b38f613caa6cadf6f51824f9e987315b3b6fe49d97bc282190087a11aa3a
Contents?: true
Size: 961 Bytes
Versions: 13
Compression:
Stored size: 961 Bytes
Contents
# frozen_string_literal: true # # Copyright (c) 2019-present, Blue Marble Payroll, LLC # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. # module Dbee class Query class Sorters # Abstract representation of the ORDER BY part of a SQL statement. class Base acts_as_hashable attr_reader :key_path def initialize(key_path:) raise ArgumentError, 'key_path is required' if key_path.to_s.empty? @key_path = KeyPath.get(key_path) freeze end def hash "#{self.class.name}#{key_path}".hash end def ==(other) other.instance_of?(self.class) && other.key_path == key_path end alias eql? == def <=>(other) "#{key_path}#{self.class.name}" <=> "#{other.key_path}#{other.class.name}" end end end end end
Version data entries
13 entries across 13 versions & 1 rubygems