{"id":20237745,"url":"https://github.com/ragmaanir/kontrakt","last_synced_at":"2026-06-05T03:32:23.169Z","repository":{"id":136218038,"uuid":"50206877","full_name":"Ragmaanir/kontrakt","owner":"Ragmaanir","description":"Simple design by contract for crystal","archived":false,"fork":false,"pushed_at":"2021-05-05T00:50:51.000Z","size":10,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-14T01:12:28.674Z","etag":null,"topics":["assertions","crystal","design-by-contracts"],"latest_commit_sha":null,"homepage":null,"language":"Crystal","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/Ragmaanir.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-01-22T20:52:50.000Z","updated_at":"2021-07-25T16:18:25.000Z","dependencies_parsed_at":null,"dependency_job_id":"86f3c3ac-2854-4e34-b757-154ab81a0a39","html_url":"https://github.com/Ragmaanir/kontrakt","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ragmaanir%2Fkontrakt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ragmaanir%2Fkontrakt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ragmaanir%2Fkontrakt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ragmaanir%2Fkontrakt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Ragmaanir","download_url":"https://codeload.github.com/Ragmaanir/kontrakt/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241685144,"owners_count":20003022,"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":["assertions","crystal","design-by-contracts"],"created_at":"2024-11-14T08:28:40.078Z","updated_at":"2026-06-05T03:32:23.163Z","avatar_url":"https://github.com/Ragmaanir.png","language":"Crystal","funding_links":[],"categories":[],"sub_categories":[],"readme":"# kontrakt [![Build Status](https://travis-ci.org/Ragmaanir/kontrakt.svg?branch=master)](https://travis-ci.org/Ragmaanir/kontrakt)\n\nKontrakt provides two macros to implement very simple design-by-contract style checks.\n\n## Installation\n\n\nAdd this to your application's `shard.yml`:\n\n```yaml\ndependencies:\n  kontrakt:\n    github: ragmaanir/kontrakt\n```\n\n\n## Usage\n\n\n```crystal\nrequire \"kontrakt\"\n\nKontrakt.precondition(1 == 5) # raises\nKontrakt.postcondition(3 == 3 \u0026\u0026 true != false) # passes\n```\n\nTo disable the conditions set DISABLE_CONTRACTS env var:\n\n```crystal\nDISABLE_CONTRACTS=1 crystal spec\n```\n\n## TODO\n\n- output the values of the variables used\n- evaluate partial expressions like power_assert.cr. maybe only show leaf-values, e.g. dont show `x \u0026\u0026 y`, just show `x` and `y`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fragmaanir%2Fkontrakt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fragmaanir%2Fkontrakt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fragmaanir%2Fkontrakt/lists"}