Class: Bmg::Sql::Processor::LimitOffset
- Inherits:
-
Bmg::Sql::Processor
- Object
- Sexpr::Rewriter
- Bmg::Sql::Processor
- Bmg::Sql::Processor::LimitOffset
- Defined in:
- lib/bmg/sql/processor/limit_offset.rb
Constant Summary
Constants inherited from Bmg::Sql::Processor
Instance Attribute Summary collapse
-
#limit ⇒ Object
readonly
Returns the value of attribute limit.
-
#offset ⇒ Object
readonly
Returns the value of attribute offset.
Attributes inherited from Bmg::Sql::Processor
Instance Method Summary collapse
-
#initialize(limit, offset, builder) ⇒ LimitOffset
constructor
A new instance of LimitOffset.
- #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(limit, offset, builder) ⇒ LimitOffset
Returns a new instance of LimitOffset.
6 7 8 9 10 |
# File 'lib/bmg/sql/processor/limit_offset.rb', line 6 def initialize(limit, offset, builder) super(builder) @limit = limit @offset = offset end |
Instance Attribute Details
#limit ⇒ Object (readonly)
Returns the value of attribute limit.
11 12 13 |
# File 'lib/bmg/sql/processor/limit_offset.rb', line 11 def limit @limit end |
#offset ⇒ Object (readonly)
Returns the value of attribute offset.
11 12 13 |
# File 'lib/bmg/sql/processor/limit_offset.rb', line 11 def offset @offset end |
Instance Method Details
#on_select_exp(sexpr) ⇒ Object
20 21 22 23 24 25 26 |
# File 'lib/bmg/sql/processor/limit_offset.rb', line 20 def on_select_exp(sexpr) sexpr = builder.from_self(sexpr) if must_from_self?(sexpr) limit_clause = builder.limit_clause(limit) offset_clause = builder.offset_clause(offset) sexpr.with_push(limit_clause, offset_clause) end |
#on_set_operator(sexpr) ⇒ Object Also known as: on_union, on_except, on_intersect
13 14 15 |
# File 'lib/bmg/sql/processor/limit_offset.rb', line 13 def on_set_operator(sexpr) apply(builder.from_self(sexpr)) end |