Class: Sequel::SQL::ColumnExpr
- Inherits:
-
Expression
- Object
- Expression
- Sequel::SQL::ColumnExpr
- Defined in:
- lib/sequel_core/sql.rb
Overview
Represents a generic column expression, used for specifying order and aliasing of columns.
Constant Summary
Constants included from ColumnMethods
Sequel::SQL::ColumnMethods::AS, Sequel::SQL::ColumnMethods::ASC, Sequel::SQL::ColumnMethods::DESC
Instance Attribute Summary collapse
-
#l ⇒ Object
readonly
Created readers for the left, operator, and right expression.
-
#op ⇒ Object
readonly
Created readers for the left, operator, and right expression.
-
#r ⇒ Object
readonly
Created readers for the left, operator, and right expression.
Instance Method Summary collapse
-
#initialize(l, op, r = nil) ⇒ ColumnExpr
constructor
Sets the attributes for the object to those given.
-
#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
Methods included from ColumnMethods
Constructor Details
#initialize(l, op, r = nil) ⇒ ColumnExpr
Sets the attributes for the object to those given. The right (r) is not required, it is used when aliasing. The left (l) usually specifies the column name, and the operator (op) is usually 'ASC', 'DESC', or 'AS'.
81 82 83 |
# File 'lib/sequel_core/sql.rb', line 81 def initialize(l, op, r = nil) @l, @op, @r = l, op, r end |
Instance Attribute Details
#l ⇒ Object (readonly)
Created readers for the left, operator, and right expression.
75 76 77 |
# File 'lib/sequel_core/sql.rb', line 75 def l @l end |
#op ⇒ Object (readonly)
Created readers for the left, operator, and right expression.
75 76 77 |
# File 'lib/sequel_core/sql.rb', line 75 def op @op end |
#r ⇒ Object (readonly)
Created readers for the left, operator, and right expression.
75 76 77 |
# File 'lib/sequel_core/sql.rb', line 75 def r @r 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.
87 88 89 |
# File 'lib/sequel_core/sql.rb', line 87 def to_s(ds) ds.column_expr_sql(self) end |