Sha256: 61d93222c1b967c02be4d4625f5887534445a3d291096a7e6d08fcca212e2181
Contents?: true
Size: 565 Bytes
Versions: 26
Compression:
Stored size: 565 Bytes
Contents
class Simple::SQL::Connection::Scope def order_by(sql_fragment) duplicate.send(:order_by!, sql_fragment) end def limit(count) duplicate.send(:limit!, count) end private # Adjust sort order def order_by!(sql_fragment) @order_by_fragment = sql_fragment self end # Adjust sort order def limit!(count) @limit = count self end # called from to_sql def apply_order_and_limit(sql) sql = "#{sql} ORDER BY #{@order_by_fragment}" if @order_by_fragment sql = "#{sql} LIMIT #{@limit}" if @limit sql end end
Version data entries
26 entries across 26 versions & 1 rubygems