Class: Sequel::SQL::OrderedExpression
- Inherits:
-
SpecificExpression
- Object
- Expression
- SpecificExpression
- Sequel::SQL::OrderedExpression
- Defined in:
- lib/sequel_core/sql.rb
Overview
Represents a column/expression to order the result set by.
Instance Attribute Summary collapse
-
#descending ⇒ Object
readonly
Whether the expression should order the result set in a descending manner.
-
#expression ⇒ Object
readonly
The expression to order the result set by.
Instance Method Summary collapse
-
#initialize(expression, descending = true) ⇒ OrderedExpression
constructor
Set the expression and descending attributes to the given values.
-
#to_s(ds) ⇒ Object
Delegate the creation of the resulting SQL to the given dataset, since it may be database dependent.
Methods inherited from Expression
Constructor Details
#initialize(expression, descending = true) ⇒ OrderedExpression
Set the expression and descending attributes to the given values.
704 705 706 |
# File 'lib/sequel_core/sql.rb', line 704 def initialize(expression, descending = true) @expression, @descending = expression, descending end |
Instance Attribute Details
#descending ⇒ Object (readonly)
Whether the expression should order the result set in a descending manner
701 702 703 |
# File 'lib/sequel_core/sql.rb', line 701 def descending @descending end |
#expression ⇒ Object (readonly)
The expression to order the result set by.
698 699 700 |
# File 'lib/sequel_core/sql.rb', line 698 def expression @expression end |
Instance Method Details
#to_s(ds) ⇒ Object
Delegate the creation of the resulting SQL to the given dataset, since it may be database dependent.
710 711 712 |
# File 'lib/sequel_core/sql.rb', line 710 def to_s(ds) ds.ordered_expression_sql(self) end |