Sha256: 268304841a03b9e6d7a1c959d4c027b24b70ce8e2c82a80b851a048600b020f3
Contents?: true
Size: 553 Bytes
Versions: 15
Compression:
Stored size: 553 Bytes
Contents
class Simple::SQL::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
15 entries across 15 versions & 1 rubygems