{"id":18084514,"url":"https://github.com/endel/occurrence-counter","last_synced_at":"2025-04-12T20:09:35.020Z","repository":{"id":56886108,"uuid":"1791238","full_name":"endel/occurrence-counter","owner":"endel","description":"Ruby utility to count occurrences from standard data types.","archived":false,"fork":false,"pushed_at":"2011-08-07T18:22:07.000Z","size":102,"stargazers_count":2,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-12T20:09:21.189Z","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/endel.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":"2011-05-24T02:04:05.000Z","updated_at":"2013-12-21T04:08:17.000Z","dependencies_parsed_at":"2022-08-20T14:31:25.748Z","dependency_job_id":null,"html_url":"https://github.com/endel/occurrence-counter","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/endel%2Foccurrence-counter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/endel%2Foccurrence-counter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/endel%2Foccurrence-counter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/endel%2Foccurrence-counter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/endel","download_url":"https://codeload.github.com/endel/occurrence-counter/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248625493,"owners_count":21135513,"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-10-31T15:07:03.178Z","updated_at":"2025-04-12T20:09:34.997Z","avatar_url":"https://github.com/endel.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Ruby Occurrence Counter\n\nUtility to count occurrences from standard data types in Ruby.\nFeel free to improve my source-code.\n\n## Add to your Gemfile\n\n    gem \"occurrence_counter\", :git =\u003e \"https://github.com/endel/occurrence-counter.git\", :branch =\u003e \"master\"\n\n## Examples:\n    # Counting Array item occurrences\n    array = [1,1,1,1,1,3,3,1,3,3,3,5,5]\n    array.count_occurrences\n    =\u003e {1 =\u003e 6, 3 =\u003e 5, 5 =\u003e 2}\n\n    # Counting word occurrences in String\n    string = \"The quick brown fox jumps over the lazy dog. Because the dog is lazy and he doesn't likes the brown color.\"\n    string.word_occurrences(:downcase)\n    =\u003e {\"the\"=\u003e4, \"quick\"=\u003e1, \"brown\"=\u003e2, \"fox\"=\u003e1, \"jumps\"=\u003e1, \"over\"=\u003e1, \"lazy\"=\u003e2, \"dog\"=\u003e2, \"because\"=\u003e1, \"is\"=\u003e1, \"and\"=\u003e1, \"he\"=\u003e1, \"doesnt\"=\u003e1, \"likes\"=\u003e1, \"color\"=\u003e1}\n\n    # Using pre-processor\n    string = \"The quick brown fox jumps over the lazy dog. Because the dog is lazy and he doesn't likes the brown color.\"\n    string.word_occurrences(lambda {|str|\n        str = str.downcase\n        str.length \u003e= 5 ? str : nil\n    })\n    =\u003e {\"quick\"=\u003e1, \"brown\"=\u003e2, \"jumps\"=\u003e1, \"because\"=\u003e1, \"doesnt\"=\u003e1, \"likes\"=\u003e1, \"color\"=\u003e1}\n\n    ","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fendel%2Foccurrence-counter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fendel%2Foccurrence-counter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fendel%2Foccurrence-counter/lists"}