Class: Dbee::Query::Sorters::Base
- Inherits:
-
Object
- Object
- Dbee::Query::Sorters::Base
- Defined in:
- lib/dbee/query/sorters/base.rb
Overview
Abstract representation of the ORDER BY part of a SQL statement.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#key_path ⇒ Object
readonly
Returns the value of attribute key_path.
Instance Method Summary collapse
- #<=>(other) ⇒ Object
- #==(other) ⇒ Object (also: #eql?)
- #hash ⇒ Object
-
#initialize(key_path:) ⇒ Base
constructor
A new instance of Base.
Constructor Details
Instance Attribute Details
#key_path ⇒ Object (readonly)
Returns the value of attribute key_path.
17 18 19 |
# File 'lib/dbee/query/sorters/base.rb', line 17 def key_path @key_path end |
Instance Method Details
#<=>(other) ⇒ Object
37 38 39 |
# File 'lib/dbee/query/sorters/base.rb', line 37 def <=>(other) "#{key_path}#{self.class.name}" <=> "#{other.key_path}#{other.class.name}" end |
#==(other) ⇒ Object Also known as: eql?
31 32 33 34 |
# File 'lib/dbee/query/sorters/base.rb', line 31 def ==(other) other.instance_of?(self.class) && other.key_path == key_path end |
#hash ⇒ Object
27 28 29 |
# File 'lib/dbee/query/sorters/base.rb', line 27 def hash "#{self.class.name}#{key_path}".hash end |