Method: SQL::Maker::Select#as_sql_order_by

Defined in:
lib/sql/maker/select.rb

#as_sql_order_byObject



239
240
241
242
243
244
245
246
247
248
249
250
251
# File 'lib/sql/maker/select.rb', line 239

def as_sql_order_by
  attrs = self.order_by
  return '' if attrs.empty?

  return 'ORDER BY ' + attrs.map {|e|
    col, type = e
    if col.respond_to?(:as_sql)
      col.as_sql
    else
      type ? self._quote(col) + " #{type}" : self._quote(col)
    end
  }.join(', ') + self.new_line
end