Class: Bmg::Sql::Processor::OrderBy
- Inherits:
-
Bmg::Sql::Processor
- Object
- Sexpr::Rewriter
- Bmg::Sql::Processor
- Bmg::Sql::Processor::OrderBy
- Defined in:
- lib/bmg/sql/processor/order_by.rb
Constant Summary
Constants inherited from Bmg::Sql::Processor
Instance Attribute Summary collapse
-
#ordering ⇒ Object
readonly
Returns the value of attribute ordering.
Attributes inherited from Bmg::Sql::Processor
Instance Method Summary collapse
-
#initialize(ordering, builder) ⇒ OrderBy
constructor
A new instance of OrderBy.
- #on_select_exp(sexpr) ⇒ Object
- #on_set_operator(sexpr) ⇒ Object (also: #on_union, #on_except, #on_intersect)
Methods inherited from Bmg::Sql::Processor
Constructor Details
#initialize(ordering, builder) ⇒ OrderBy
Returns a new instance of OrderBy.
6 7 8 9 |
# File 'lib/bmg/sql/processor/order_by.rb', line 6 def initialize(ordering, builder) super(builder) @ordering = ordering end |
Instance Attribute Details
#ordering ⇒ Object (readonly)
Returns the value of attribute ordering.
10 11 12 |
# File 'lib/bmg/sql/processor/order_by.rb', line 10 def ordering @ordering end |
Instance Method Details
#on_select_exp(sexpr) ⇒ Object
19 20 21 22 23 24 25 26 27 |
# File 'lib/bmg/sql/processor/order_by.rb', line 19 def on_select_exp(sexpr) if sexpr.order_by? || sexpr.group_by? sexpr = builder.from_self(sexpr) call(sexpr) else needed = builder.order_by_clause(ordering, &sexpr.desaliaser) sexpr.dup.push(needed) end end |
#on_set_operator(sexpr) ⇒ Object Also known as: on_union, on_except, on_intersect
12 13 14 |
# File 'lib/bmg/sql/processor/order_by.rb', line 12 def on_set_operator(sexpr) call(builder.from_self(sexpr)) end |