{"id":13462937,"url":"https://github.com/mynameisrufus/sorted","last_synced_at":"2025-03-25T06:31:26.587Z","repository":{"id":59155990,"uuid":"771813","full_name":"mynameisrufus/sorted","owner":"mynameisrufus","description":"Sorting library","archived":false,"fork":false,"pushed_at":"2019-06-26T08:21:12.000Z","size":155,"stargazers_count":63,"open_issues_count":0,"forks_count":27,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-03T07:03:03.176Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mynameisrufus.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2010-07-13T04:23:52.000Z","updated_at":"2023-09-26T22:40:21.000Z","dependencies_parsed_at":"2022-09-13T17:51:03.196Z","dependency_job_id":null,"html_url":"https://github.com/mynameisrufus/sorted","commit_stats":null,"previous_names":[],"tags_count":27,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mynameisrufus%2Fsorted","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mynameisrufus%2Fsorted/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mynameisrufus%2Fsorted/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mynameisrufus%2Fsorted/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mynameisrufus","download_url":"https://codeload.github.com/mynameisrufus/sorted/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245413782,"owners_count":20611353,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-31T13:00:41.444Z","updated_at":"2025-03-25T06:31:26.284Z","avatar_url":"https://github.com/mynameisrufus.png","language":"Ruby","readme":"# Sorted\n\n[![Build Status](https://travis-ci.org/mynameisrufus/sorted.svg?branch=master)](https://travis-ci.org/mynameisrufus/sorted)\n\nSorted at it's core is a set of objects that let you sort many different\nattributes in weird and wonderful ways.\n\n## Example\n\nThe secret sauce is the `Sorted::Set` object, in this example we 'toggle' email:\n\n```ruby\nrequire 'sorted/set'\n\na = Sorted::Set.new([['email', 'asc'], ['name', 'asc']])\nb = Sorted::Set.new([['email', 'asc'], ['phone', 'asc']])\n\ns = a.direction_intersect(b)\n\ns.to_a #=\u003e [['email', 'desc'], ['phone', 'asc'], ['name', 'asc']]\n```\n\nThe best way to think about this is to imagine a spreed sheet and what happens\nwhen you sort by various columns, `Sorted::Set` pretty much just does that.\n\n## Parsers/Encoders\n\nParsers return a `Sorted::Set` that can then be used by an encoder:\n\n```ruby\nrequire 'sorted/uri_query'\n\nset = Sorted::URIQuery.parse('name_asc!email_asc')\nSorted::SQLQuery.encode(set) #=\u003e 'name ASC email ASC'\n```\n\nCurrently implemented:\n\n* `Sorted::SQLQuery`\n* `Sorted::URIQuery`\n* `Sorted::JSONQuery`\n* `Sorted::ElasticsearchQuery`\n* `Sorted::ParamsQuery`\n\n## Projects\n\n* Mongoid https://github.com/dleavitt/sorted-mongoid\n* ActiveRecord https://github.com/mynameisrufus/sorted-activerecord\n* ActionView https://github.com/mynameisrufus/sorted-actionview\n","funding_links":[],"categories":["Active Record Plugins","Ruby"],"sub_categories":["Pagination"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmynameisrufus%2Fsorted","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmynameisrufus%2Fsorted","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmynameisrufus%2Fsorted/lists"}