{"id":20842807,"url":"https://github.com/mudge/if","last_synced_at":"2025-10-28T08:44:55.006Z","repository":{"id":3878706,"uuid":"4965285","full_name":"mudge/if","owner":"mudge","description":"Implementing if in Ruby without using keywords.","archived":false,"fork":false,"pushed_at":"2015-03-15T13:08:47.000Z","size":148,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-25T08:39:04.404Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://mudge.github.com/2012/07/09/implementing-if-in-ruby.html","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/mudge.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":"2012-07-09T21:43:04.000Z","updated_at":"2021-07-09T19:09:46.000Z","dependencies_parsed_at":"2022-08-20T23:10:37.390Z","dependency_job_id":null,"html_url":"https://github.com/mudge/if","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/mudge/if","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mudge%2Fif","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mudge%2Fif/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mudge%2Fif/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mudge%2Fif/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mudge","download_url":"https://codeload.github.com/mudge/if/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mudge%2Fif/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":281410756,"owners_count":26496368,"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","status":"online","status_checked_at":"2025-10-28T02:00:06.022Z","response_time":60,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":"2024-11-18T01:25:34.047Z","updated_at":"2025-10-28T08:44:54.975Z","avatar_url":"https://github.com/mudge.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# if [![Build Status](https://secure.travis-ci.org/mudge/if.png?branch=master)](http://travis-ci.org/mudge/if)\n\nSee \"[Implementing `if` in Ruby](http://mudge.github.com/2012/07/09/implementing-if-in-ruby.html)\" for more information.\n\n## Requirements\n\nThis library is tested on Ruby 1.8.7 and later but benefits from Ruby 1.9's\nhash and lambda literal syntax.\n\n```ruby\n\"truthy\".if -\u003e { \"I'm true!\" }, else: -\u003e { \"I'm false!\" }\n# vs.\n\"truthy\".if proc { \"I'm true!\" }, :else =\u003e proc { \"I'm false!\" }\n```\n\n## Usage\n\n```ruby\nrequire \"if\"\n\n\"Some truthy object\".if -\u003e { \"I'm true!\" }, else: -\u003e { \"I'm false!\" }\n#=\u003e \"I'm true!\"\n\nnil.if -\u003e { \"I'm true!\" }, else: -\u003e { \"I'm false!\" }\n#=\u003e \"I'm false!\"\n\n# Or, if you only care about side-effects and not return value:\n\n\"Some truthy object\"\n  .if_true { puts \"I'm true!\" }\n  .if_false { puts \"I'm false!\" }\n# \"I'm true!\"\n#=\u003e \"Some truthy object\"\n\nnil\n  .if_true { puts \"I'm true!\" }\n  .if_false { puts \"I'm false!\" }\n# \"I'm false!\"\n#=\u003e nil\n```\n\n## License\n\nCopyright © 2015 Paul Mucur\n\nDistributed under the MIT License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmudge%2Fif","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmudge%2Fif","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmudge%2Fif/lists"}