Sha256: 04f84bfd9dc098c2b11233bf0b6d8baf3ba59bd6d308eb21743733e22705cb2c

Contents?: true

Size: 502 Bytes

Versions: 8

Compression:

Stored size: 502 Bytes

Contents

module Schemas
  class Paginate < PaginationSearch::HashPaginate
    protected

    def searched(items, search)
      search = expand_dot_notation(search) if /\A[A-z]+\.[A-z]+\z/ =~ search
      super(items, search)
    end

    def sorted(items, _)
      items.sort_by { |i| "#{i[:schema]}.#{i[:table]}.#{i[:column]}" }.reverse
    end

    private

    def expand_dot_notation(search)
      schema, table = search.split('.')
      "schema:#{schema} table:#{table} match_type:exact"
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
aleph_analytics-0.1.0 lib/schemas/paginate.rb
aleph_analytics-0.0.6 lib/schemas/paginate.rb
aleph_analytics-0.0.5 lib/schemas/paginate.rb
aleph_analytics-0.0.4 lib/schemas/paginate.rb
aleph_analytics-0.0.3 lib/schemas/paginate.rb
aleph_analytics-0.0.2 lib/schemas/paginate.rb
aleph_analytics-0.0.1.alpha lib/schemas/paginate.rb
aleph_analytics-0.0.0.alpha lib/schemas/paginate.rb