Class: OrderClause
- Defined in:
- lib/activeleopard/query_clauses/order_clause.rb
Instance Attribute Summary collapse
-
#ordering_attr ⇒ Object
Returns the value of attribute ordering_attr.
Instance Method Summary collapse
- #as_sql ⇒ Object
-
#initialize(ordering_attr = nil) ⇒ OrderClause
constructor
A new instance of OrderClause.
Constructor Details
#initialize(ordering_attr = nil) ⇒ OrderClause
Returns a new instance of OrderClause.
4 5 6 |
# File 'lib/activeleopard/query_clauses/order_clause.rb', line 4 def initialize(ordering_attr = nil) @ordering_attr = ordering_attr end |
Instance Attribute Details
#ordering_attr ⇒ Object
Returns the value of attribute ordering_attr.
2 3 4 |
# File 'lib/activeleopard/query_clauses/order_clause.rb', line 2 def ordering_attr @ordering_attr end |
Instance Method Details
#as_sql ⇒ Object
8 9 10 11 |
# File 'lib/activeleopard/query_clauses/order_clause.rb', line 8 def as_sql return "" if ordering_attr.nil? "ORDER BY #{ordering_attr.to_s}" end |