{"id":13412032,"url":"https://github.com/ankane/hightop","last_synced_at":"2025-11-17T14:13:05.868Z","repository":{"id":16918834,"uuid":"19680171","full_name":"ankane/hightop","owner":"ankane","description":"A nice shortcut for group count queries","archived":false,"fork":false,"pushed_at":"2025-05-05T03:44:49.000Z","size":80,"stargazers_count":500,"open_issues_count":0,"forks_count":8,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-05-14T11:52:09.528Z","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/ankane.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2014-05-11T23:28:58.000Z","updated_at":"2025-05-13T13:42:48.000Z","dependencies_parsed_at":"2024-01-13T03:01:01.497Z","dependency_job_id":"1f9909ca-53e1-4b65-b1f3-cdd951574eca","html_url":"https://github.com/ankane/hightop","commit_stats":{"total_commits":145,"total_committers":1,"mean_commits":145.0,"dds":0.0,"last_synced_commit":"c921bd72f80de35a5e8e58026f3e742af8a48b03"},"previous_names":[],"tags_count":18,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ankane%2Fhightop","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ankane%2Fhightop/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ankane%2Fhightop/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ankane%2Fhightop/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ankane","download_url":"https://codeload.github.com/ankane/hightop/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254160557,"owners_count":22024571,"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-30T20:01:20.323Z","updated_at":"2025-11-17T14:13:05.834Z","avatar_url":"https://github.com/ankane.png","language":"Ruby","funding_links":[],"categories":["Ruby","Gems","ActiveRecord"],"sub_categories":["Query Enhancement"],"readme":"# Hightop\n\nA nice shortcut for group count queries\n\n```ruby\nVisit.top(:browser)\n# {\n#   \"Chrome\"  =\u003e 63,\n#   \"Safari\"  =\u003e 50,\n#   \"Firefox\" =\u003e 34\n# }\n```\n\nWorks with Active Record, Mongoid, arrays and hashes\n\n[![Build Status](https://github.com/ankane/hightop/actions/workflows/build.yml/badge.svg)](https://github.com/ankane/hightop/actions)\n\n## Installation\n\nAdd this line to your application’s Gemfile:\n\n```ruby\ngem \"hightop\"\n```\n\n## Options\n\nLimit the results\n\n```ruby\nVisit.top(:referring_domain, 10)\n```\n\nInclude nil values\n\n```ruby\nVisit.top(:search_keyword, nil: true)\n```\n\nWorks with multiple groups\n\n```ruby\nVisit.top([:city, :browser])\n```\n\nAnd expressions\n\n```ruby\nVisit.top(Arel.sql(\"LOWER(referring_domain)\"))\n```\n\nAnd distinct\n\n```ruby\nVisit.top(:city, distinct: :user_id)\n```\n\nAnd min count\n\n```ruby\nVisit.top(:city, min: 10)\n```\n\n## Arrays and Hashes\n\nArrays\n\n```ruby\n[\"up\", \"up\", \"down\"].top\n```\n\nHashes\n\n```ruby\n{a: \"up\", b: \"up\", c: \"down\"}.top { |k, v| v }\n```\n\nLimit the results\n\n```ruby\n[\"up\", \"up\", \"down\"].top(1)\n```\n\nInclude nil values\n\n```ruby\n[nil, nil, \"down\"].top(nil: true)\n```\n\nMin count\n\n```ruby\n[\"up\", \"up\", \"down\"].top(min: 2)\n```\n\n## History\n\nView the [changelog](https://github.com/ankane/hightop/blob/master/CHANGELOG.md)\n\n## Contributing\n\nEveryone is encouraged to help improve this project. Here are a few ways you can help:\n\n- [Report bugs](https://github.com/ankane/hightop/issues)\n- Fix bugs and [submit pull requests](https://github.com/ankane/hightop/pulls)\n- Write, clarify, or fix documentation\n- Suggest or add new features\n\nTo get started with development:\n\n```sh\ngit clone https://github.com/ankane/hightop.git\ncd hightop\nbundle install\nbundle exec rake test\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fankane%2Fhightop","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fankane%2Fhightop","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fankane%2Fhightop/lists"}