{"id":25655006,"url":"https://github.com/wizzardx/bracket","last_synced_at":"2026-06-18T17:32:09.241Z","repository":{"id":278873605,"uuid":"937048647","full_name":"wizzardx/bracket","owner":"wizzardx","description":"A Crystal shard implementing the bracket pattern for safe resource management. Ensures proper initialization and cleanup of resources, similar to Python's context managers or Haskell's bracket pattern.","archived":false,"fork":false,"pushed_at":"2025-02-22T08:04:38.000Z","size":0,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-22T08:30:56.518Z","etag":null,"topics":["bracket-pattern","context-manager","crystal","crystal-shard","raii","resource-management","safe-resource-handling"],"latest_commit_sha":null,"homepage":"https://wizzardx.github.io/bracket/","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/wizzardx.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":"2025-02-22T07:53:31.000Z","updated_at":"2025-02-22T08:02:54.000Z","dependencies_parsed_at":"2025-02-22T08:41:47.023Z","dependency_job_id":null,"html_url":"https://github.com/wizzardx/bracket","commit_stats":null,"previous_names":["wizzardx/bracket"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/wizzardx/bracket","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wizzardx%2Fbracket","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wizzardx%2Fbracket/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wizzardx%2Fbracket/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wizzardx%2Fbracket/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wizzardx","download_url":"https://codeload.github.com/wizzardx/bracket/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wizzardx%2Fbracket/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34501472,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-18T02:00:06.871Z","response_time":128,"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":["bracket-pattern","context-manager","crystal","crystal-shard","raii","resource-management","safe-resource-handling"],"created_at":"2025-02-23T21:18:59.800Z","updated_at":"2026-06-18T17:32:09.225Z","avatar_url":"https://github.com/wizzardx.png","language":"Crystal","funding_links":[],"categories":[],"sub_categories":[],"readme":"# bracket\n\nA Crystal shard that implements the bracket pattern for safe resource management. This pattern ensures that resources are properly initialized and cleaned up, similar to Python's context managers or Haskell's bracket pattern.\n\n## Installation\n\n1. Add the dependency to your `shard.yml`:\n\n   ```yaml\n   dependencies:\n     bracket:\n       github: wizzardx/bracket\n   ```\n\n2. Run `shards install`\n\n## Usage\n\n```crystal\nrequire \"bracket\"\n\n# Simple example with a string resource\nsetup = -\u003e { \"my resource\" }\nteardown = -\u003e(resource : String) { puts \"Cleaning up #{resource}\"; nil }\n\nBracket.with_resource(setup, teardown) do |resource|\n  puts \"Using #{resource}\"\nend\n\n# Example with server resource\nserver_setup = -\u003e {\n  port = find_available_port\n  server = start_server(port)\n  {server, port}\n}\n\nserver_teardown = -\u003e(resource : Tuple(Server, Int32)) {\n  server, port = resource\n  server.stop\n  nil\n}\n\nBracket.with_resource(server_setup, server_teardown) do |resource|\n  server, port = resource\n  # Use server...\nend\n```\n\n## Features\n\n- Guarantees resource cleanup even if an exception occurs\n- Type-safe resource handling\n- Simple, functional interface\n- Works with any resource type\n\n## Development\n\nRun tests:\n```crystal\ncrystal spec\n```\n\n## Contributing\n\n1. Fork it (\u003chttps://github.com/wizzardx/bracket/fork\u003e)\n2. Create your feature branch (`git checkout -b my-new-feature`)\n3. Commit your changes (`git commit -am 'Add some feature'`)\n4. Push to the branch (`git push origin my-new-feature`)\n5. Create a new Pull Request\n\n## Contributors\n\n- [David Purdy](https://github.com/wizzardx) - creator and maintainer\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwizzardx%2Fbracket","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwizzardx%2Fbracket","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwizzardx%2Fbracket/lists"}