Sha256: e0348f02960e8b6a51339a1daa36ddda436de956240fdb96f70b39bc105bed3c

Contents?: true

Size: 657 Bytes

Versions: 4

Compression:

Stored size: 657 Bytes

Contents

# Backport of `reorder` method from Origin 2.1.0+
if defined?(Origin::Optional) && !Origin::Optional.method_defined?(:reorder)
  module Origin
    module Optional

      # Instead of merging the order criteria, use this method to completely
      # replace the existing ordering with the provided.
      #
      # @example Replace the ordering.
      #   optional.reorder(name: :asc)
      #
      # @param [ Array, Hash, String ] spec The sorting specification.
      #
      # @return [ Optional ] The cloned optional.
      #
      # @since 2.1.0
      def reorder(*spec)
        options.delete(:sort)
        order_by(*spec)
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
ta_by_star-4.1.0 lib/by_star/orm/mongoid/reorder.rb
ta_by_star-4.0.0 lib/by_star/orm/mongoid/reorder.rb
by_star-4.0.0 lib/by_star/orm/mongoid/reorder.rb
by_star-3.0.0 lib/by_star/orm/mongoid/reorder.rb