{"id":31655492,"url":"https://github.com/r4gus/zon-rb","last_synced_at":"2026-01-20T17:32:42.106Z","repository":{"id":316933579,"uuid":"1064540228","full_name":"r4gus/zon-rb","owner":"r4gus","description":"Zig Object Notation for Ruby","archived":false,"fork":false,"pushed_at":"2025-09-27T17:12:05.000Z","size":36,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-09-27T18:20:18.343Z","etag":null,"topics":["gem","ruby","ruby-gem","ruby-gems","zig","zig-object-notation","ziglang","zon"],"latest_commit_sha":null,"homepage":"https://rubygems.org/gems/zon-rb","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/r4gus.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-09-26T07:23:34.000Z","updated_at":"2025-09-27T17:12:08.000Z","dependencies_parsed_at":"2025-10-02T11:18:07.837Z","dependency_job_id":null,"html_url":"https://github.com/r4gus/zon-rb","commit_stats":null,"previous_names":["r4gus/zon-rb"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/r4gus/zon-rb","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/r4gus%2Fzon-rb","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/r4gus%2Fzon-rb/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/r4gus%2Fzon-rb/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/r4gus%2Fzon-rb/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/r4gus","download_url":"https://codeload.github.com/r4gus/zon-rb/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/r4gus%2Fzon-rb/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278780059,"owners_count":26044492,"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-07T02:00:06.786Z","response_time":59,"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":["gem","ruby","ruby-gem","ruby-gems","zig","zig-object-notation","ziglang","zon"],"created_at":"2025-10-07T13:14:41.425Z","updated_at":"2026-01-20T17:32:42.091Z","avatar_url":"https://github.com/r4gus.png","language":"Ruby","readme":"# Zig Object Notation (ZON) for Ruby\n\n[![Gem Version](https://badge.fury.io/rb/zon-rb.svg?icon=si%3Arubygems)](https://badge.fury.io/rb/zon-rb)\n\nThe [Zig](https://ziglang.org/) Object Notation (ZON) is a file format primarily used within the Zig ecosystem. For example, ZON is used for the Zig package [manifest](https://github.com/ziglang/zig/blob/b7ab62540963d80f68d0e9ee7ce18520fb173487/doc/build.zig.zon.md).\n\n## Installation\n\nInstall the gem and add to the application's Gemfile by executing:\n\n```bash\nbundle add zon-rb\n```\n\nIf bundler is not being used to manage dependencies, install the gem by executing:\n\n```bash\ngem install zon-rb\n```\n\n## Usage\n\nTo use this Gem you have to require it:\n\n```ruby\nrequire \"zon\"\n```\n\nTo parse ZON data into a Ruby object, one can use the `Zon::parse` method. The method expects either a `String` or `IO` (`File`) object as its argument.\n\n```irb\nirb(main):001\u003e Zon::parse(\".{ \\\"foo\\\", \\\"bar\\\"}\")\n=\u003e [\"foo\", \"bar\"]\nirb(main):002\u003e Zon.parse(File.open(\"../PassKeeZ/build.zig.zon\"))\n=\u003e\n{name: :passkeez,\n version: \"0.5.3\",\n minimum_zig_version: \"0.15.1\",\n fingerprint: 15931082159778014966,\n dependencies:\n  {keylib:\n    {url: \"https://github.com/Zig-Sec/keylib/archive/refs/tags/0.7.0.tar.gz\",\n     hash: \"keylib-0.7.0-mbYjk6qaCQACutrMpyhgstSmYxSKmcuRmLI-CJSumBeA\"},\n   uuid:\n    {url: \"https://github.com/r4gus/uuid-zig/archive/refs/tags/0.4.0.tar.gz\",\n     hash: \"uuid-0.4.0-oOieIR2AAAChAUVBY4ABjYI1XN0EbVALmiN0JIlggC3i\"},\n   kdbx: {path: \"../kdbx\"}},\n paths: [\"build.zig\", \"build.zig.zon\", \"linux\", \"README.md\", \"script\", \"src\", \"static\"]}\n```\n\nTo serialize a Ruby object into ZON, use the `Zon::serialize` method. \n\n```irb\nirb(main):002\u003e o\n=\u003e\n{name: :passkeez,\n version: \"0.5.3\",\n minimum_zig_version: \"0.15.1\",\n fingerprint: 15931082159778014966,\n dependencies:\n  {keylib: {url: \"https://github.com/Zig-Sec/keylib/archive/refs/tags/0.7.0.tar.gz\", hash: \"keylib-0.7.0-mbYjk6qaCQACutrMpyhgstSmYxSKmcuRmLI-CJSumBeA\"},\n   uuid: {url: \"https://github.com/r4gus/uuid-zig/archive/refs/tags/0.4.0.tar.gz\", hash: \"uuid-0.4.0-oOieIR2AAAChAUVBY4ABjYI1XN0EbVALmiN0JIlggC3i\"},\n   kdbx: {path: \"../kdbx\"}},\n paths: [\"build.zig\", \"build.zig.zon\", \"linux\", \"README.md\", \"script\", \"src\", \"static\"]}\nirb(main):013\u003e puts(Zon::serialize(o, {:indent_level =\u003e 4}))\n.{\n    .name = .passkeez,\n    .version = \"0.5.3\",\n    .minimum_zig_version = \"0.15.1\",\n    .fingerprint = 0xdd1692d15d21a6f6,\n    .dependencies = .{\n        .keylib = .{\n            .url = \"https://github.com/Zig-Sec/keylib/archive/refs/tags/0.7.0.tar.gz\",\n            .hash = \"keylib-0.7.0-mbYjk6qaCQACutrMpyhgstSmYxSKmcuRmLI-CJSumBeA\",\n        },\n        .uuid = .{\n            .url = \"https://github.com/r4gus/uuid-zig/archive/refs/tags/0.4.0.tar.gz\",\n            .hash = \"uuid-0.4.0-oOieIR2AAAChAUVBY4ABjYI1XN0EbVALmiN0JIlggC3i\",\n        },\n        .kdbx = .{\n            .path = \"../kdbx\",\n        },\n    },\n    .paths = .{\n        \"build.zig\",\n        \"build.zig.zon\",\n        \"linux\",\n        \"README.md\",\n        \"script\",\n        \"src\",\n        \"static\",\n    },\n}\n```\n\nTo customize the generated ZON data one can use the `:indent_level` and `:ibase` options. The `:indent_level` specifies how much each block is indented. The `:ibase` option can be used to define in which format (hex: 16, octal: 8, binary: 2, decimal: 10) an `Integer` should be serialized. The default for `:ibase` is `16` (hexadecimal).\n\n```irb\nirb(main):010\u003e Zon::serialize(255, {:ibase =\u003e 2})\n=\u003e \"0b11111111\"\n```\n\n### Zig Manifest\n\n`Zon::Zig::Manifest` provides you with an abstraction for your `build.zig.zon`. It will also validate your Zig package [manifest](https://github.com/ziglang/zig/blob/b7ab62540963d80f68d0e9ee7ce18520fb173487/doc/build.zig.zon.md) and raise an exception if one of the required fields is missing.\n\n```ruby\no = Zon::parse(File.open(\"../PassKeeZ/build.zig.zon\"))\nmanifest = Zon::Zig::Manifest.new o\n\n# Use:\n# manifest.name\n# manifest.version\n# ...\n```\n\n### Zig Package Hash\n\nGiven a path `pdir` that points to the root of a Zig package, one can calculate the packages hash using the `Zon::Hasher`:\n\n```ruby\nhasher = Zon::Zig::Hasher.new pdir\nhasher.hash\n# Hash with the format nnnn-vvvv-XXXX..XXXX\n# e.g.: uuid-0.4.0-oOieIR2AAAChAUVBY4ABjYI1XN0EbVALmiN0JIlggC3i\nresult = hasher.result\n```\n\n## Development\n\nAfter checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.\n\nTo install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at https://github.com/r4gus/zon-rb.\n\n## License\n\nThe gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fr4gus%2Fzon-rb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fr4gus%2Fzon-rb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fr4gus%2Fzon-rb/lists"}