Class: OrderClause

Inherits:
Object show all
Defined in:
lib/activeleopard/query_clauses/order_clause.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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_attrObject

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_sqlObject



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