Sha256: ee72921c42439ef5ba30bd44ecacfc420a63f9d4dc705fa7760977bdb4982a8b

Contents?: true

Size: 636 Bytes

Versions: 3

Compression:

Stored size: 636 Bytes

Contents

module Trailblazer
  class Finder
    module Adapters
      module DataMapper
        # Sequel - Sorting Adapter
        module Sorting
          def self.included(base)
            base.extend Features::Sorting::ClassMethods
          end

          private

          def sort_it(entity_type, sort_attribute, sort_direction)
            case sort_direction
            when 'asc', 'ascending'
              entity_type.all(order: [sort_attribute.to_sym.asc])
            when 'desc', 'descending'
              entity_type.all(order: [sort_attribute.to_sym.desc])
            end
          end
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
trailblazer-finder-0.1.2 lib/trailblazer/finder/adapters/data_mapper/sorting.rb
trailblazer-finder-0.1.1 lib/trailblazer/finder/adapters/data_mapper/sorting.rb
trailblazer-finder-0.1.0 lib/trailblazer/finder/adapters/data_mapper/sorting.rb