{"id":21502403,"url":"https://github.com/fixrb/defi","last_synced_at":"2026-03-07T00:31:10.363Z","repository":{"id":62556934,"uuid":"41492778","full_name":"fixrb/defi","owner":"fixrb","description":"Challenge library.","archived":false,"fork":false,"pushed_at":"2024-12-31T19:59:05.000Z","size":90,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-12-21T13:23:12.364Z","etag":null,"topics":["ruby","testing-library"],"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/fixrb.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":"CODE_OF_CONDUCT.md","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}},"created_at":"2015-08-27T14:49:54.000Z","updated_at":"2024-12-31T19:59:08.000Z","dependencies_parsed_at":"2024-12-31T20:28:50.982Z","dependency_job_id":"8eada26c-9c66-45d2-9b38-d23d107a8126","html_url":"https://github.com/fixrb/defi","commit_stats":{"total_commits":54,"total_committers":3,"mean_commits":18.0,"dds":"0.16666666666666663","last_synced_commit":"5588a66d017b0b08b362f9da013698aaf91248e1"},"previous_names":[],"tags_count":18,"template":false,"template_full_name":null,"purl":"pkg:github/fixrb/defi","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fixrb%2Fdefi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fixrb%2Fdefi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fixrb%2Fdefi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fixrb%2Fdefi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fixrb","download_url":"https://codeload.github.com/fixrb/defi/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fixrb%2Fdefi/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30204154,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-06T19:07:06.838Z","status":"ssl_error","status_checked_at":"2026-03-06T18:57:34.882Z","response_time":250,"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":["ruby","testing-library"],"created_at":"2024-11-23T18:14:48.610Z","updated_at":"2026-03-07T00:31:10.344Z","avatar_url":"https://github.com/fixrb.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Defi\n\n[![Version](https://img.shields.io/github/v/tag/fixrb/defi?label=Version\u0026logo=github)](https://github.com/fixrb/defi/tags)\n[![Yard documentation](https://img.shields.io/badge/Yard-documentation-blue.svg?logo=github)](https://rubydoc.info/github/fixrb/defi/main)\n[![License](https://img.shields.io/github/license/fixrb/defi?label=License\u0026logo=github)](https://github.com/fixrb/defi/raw/main/LICENSE.md)\n\n**Defi** is a streamlined Ruby library designed for the specification of method arguments while respecting their signatures.\nRather than representing method signatures themselves, Defi focuses on providing a way to furnish methods with appropriate arguments, thereby preparing them for invocation.\n\nThis approach serves as an alternative to traditional methods like `Object#method` and `UnboundMethod`.\nWhere `Object#method` is bound to a specific object and `UnboundMethod` requires compatibility with the method’s originating class, Defi offers a more flexible and universal way to prepare method calls.\nIt allows method arguments to be specified in advance and then applied to any compatible object – those equipped with corresponding methods.\n\nDefi is particularly useful in scenarios where you need to apply a set of method arguments across different objects to observe the varying outcomes, whether they be returned values or exceptions.\nThis makes it an ideal tool for testing, method comparison across different implementations, or any situation where method behavior needs to be assessed dynamically across various objects.\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem \"defi\"\n```\n\nAnd then execute:\n\n```sh\nbundle install\n```\n\nOr install it yourself as:\n\n```sh\ngem install defi\n```\n\n## Usage\n\nThe `Defi` library simplifies the task of applying method signatures to various objects, regardless of their type (instances, modules, etc.).\nBelow are some detailed examples to demonstrate its versatility and ease of use:\n\n### Example 1: Multiplying Numbers\n\nSuppose you want to multiply the number `6` by `7`.\nWith `Defi`, this can be elegantly done as follows:\n\n```ruby\nresult = Defi(:*, 7).to(6).call\nputs result # Output: 42\n```\n\nHere, `Defi(:*, 7)` creates a challenge with the multiplication method (`:*`) and the argument `7`.\nThe `.to(6)` method specifies that this challenge should be applied to the number `6`.\nFinally, `.call` executes the challenge, yielding the result `42`.\n\n### Example 2: Invoking an Undefined Method\n\n`Defi` also elegantly handles cases where the method might not exist on the target object.\nFor instance:\n\n```ruby\nbegin\n  Defi(:boom).to(\"foo\").call\nrescue NoMethodError =\u003e e\n  puts e.message # Output: undefined method `boom' for \"foo\":String\nend\n```\n\nIn this example, we attempt to call the non-existent method `boom` on the string `\"foo\"`.\n`Defi` correctly raises a `NoMethodError`, showing that the method `boom` is undefined for a `String` object.\n\n## Contact\n\n* Source code: https://github.com/fixrb/defi/issues\n\n## Versioning\n\n__Defi__ follows [Semantic Versioning 2.0](https://semver.org/).\n\n## License\n\nThe [gem](https://rubygems.org/gems/defi) is available as open source under the terms of the [MIT License](https://github.com/fixrb/defi/raw/main/LICENSE.md).\n\n## Sponsors\n\nThis project is sponsored by [Sashité](https://sashite.com/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffixrb%2Fdefi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffixrb%2Fdefi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffixrb%2Fdefi/lists"}