{"id":43998723,"url":"https://github.com/mdesantis/proc_for_case_equality","last_synced_at":"2026-02-07T12:04:44.978Z","repository":{"id":2269387,"uuid":"3225819","full_name":"mdesantis/proc_for_case_equality","owner":"mdesantis","description":"proc_for_case_equality - Ruby gem for using procs in case comparisons","archived":false,"fork":false,"pushed_at":"2012-01-20T16:17:06.000Z","size":152,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2026-01-13T06:40:38.115Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://github.com/mdesantis/proc_for_case_equality","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/mdesantis.png","metadata":{"files":{"readme":"README.rdoc","changelog":"CHANGELOG","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":"2012-01-20T11:21:45.000Z","updated_at":"2014-02-26T15:38:25.000Z","dependencies_parsed_at":"2022-08-20T23:40:58.540Z","dependency_job_id":null,"html_url":"https://github.com/mdesantis/proc_for_case_equality","commit_stats":null,"previous_names":["prognommers/proc_for_case_equality"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/mdesantis/proc_for_case_equality","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mdesantis%2Fproc_for_case_equality","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mdesantis%2Fproc_for_case_equality/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mdesantis%2Fproc_for_case_equality/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mdesantis%2Fproc_for_case_equality/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mdesantis","download_url":"https://codeload.github.com/mdesantis/proc_for_case_equality/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mdesantis%2Fproc_for_case_equality/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29194015,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-07T07:37:03.739Z","status":"ssl_error","status_checked_at":"2026-02-07T07:37:03.029Z","response_time":63,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":"2026-02-07T12:04:44.826Z","updated_at":"2026-02-07T12:04:44.968Z","avatar_url":"https://github.com/mdesantis.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"= ProcForCaseEquality.new { puts 'procs in case statements are cool!' }\n\n== Features\n\nSimple yet powerful: it lets you use procs for case comparisons (see the example below).\n\n== How\n\n+case+ statements call the \u003ctt\u003e===\u003c/tt\u003e method, so I wrote a +ProcForCaseEquality+ class\nthat inherits from +Proc+ and overrides \u003ctt\u003e===\u003c/tt\u003e, letting the case statement call the proc\npassing the value of the case as argument.\n\nThe source code is so simple that I can put it in full here:\n\n    class ProcForCaseEquality \u003c Proc\n      def ===(*params)\n        self.call *params\n      end\n    end\n\n5 LOCs :P\n\n== Installation\n\n\u003ctt\u003egem install proc_for_case_equality\u003c/tt\u003e\n\n== Usage / Examples\n\n    require 'proc_for_case_equality' # OR:\n    require 'proc_for_case_equality/pfce' # if you want PFCE constant to point to ProcForCaseEquality\n\n    # Define some procs\n    all_multiples_of_3 = ProcForCaseEquality.new { |numbers| numbers.all? { |number| number.modulo(3).zero? } }\n    any_multiple_of_3  = PFCE.new { |numbers| numbers.any? { |number| number.modulo(3).zero? } } # PFCE is provided by 'proc_for_case_equality/pfce'\n\n    # Here we come\n    case [1, 2, 3]\n    when all_multiples_of_3 \n      puts 'all numbers are multiples of 3'\n    when any_multiple_of_3\n      puts 'at least one number is multiple of 3'\n    else\n      puts 'no multiples of 3'\n    end\n\n== Inspired by\n\n{This article}[http://www.aimred.com/news/developers/2008/08/14/unlocking_the_power_of_case_equality_proc/]\n\n== License\n\nMIT (see {LICENSE}[https://github.com/ProGNOMmers/proc_for_case_equality/blob/master/LICENSE])\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmdesantis%2Fproc_for_case_equality","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmdesantis%2Fproc_for_case_equality","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmdesantis%2Fproc_for_case_equality/lists"}