{"id":13513443,"url":"https://github.com/kgiszczak/tomlib","last_synced_at":"2025-05-16T07:05:37.484Z","repository":{"id":50671347,"uuid":"519786196","full_name":"kgiszczak/tomlib","owner":"kgiszczak","description":"Tomlib is a fast and standards-compliant TOML parser and generator for Ruby.","archived":false,"fork":false,"pushed_at":"2024-11-29T14:04:42.000Z","size":244,"stargazers_count":52,"open_issues_count":0,"forks_count":4,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-08T16:09:37.831Z","etag":null,"topics":["gem","ruby","toml","toml-generator","toml-parser","toml-parsing"],"latest_commit_sha":null,"homepage":"","language":"C","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/kgiszczak.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}},"created_at":"2022-07-31T13:38:10.000Z","updated_at":"2024-11-29T14:03:18.000Z","dependencies_parsed_at":"2024-03-08T09:04:52.013Z","dependency_job_id":"ca6275ee-49c9-48b5-8463-f1f8763a305b","html_url":"https://github.com/kgiszczak/tomlib","commit_stats":{"total_commits":39,"total_committers":2,"mean_commits":19.5,"dds":0.02564102564102566,"last_synced_commit":"1a952e5ede1cc9ca365f6058705940afbcb67fa3"},"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kgiszczak%2Ftomlib","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kgiszczak%2Ftomlib/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kgiszczak%2Ftomlib/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kgiszczak%2Ftomlib/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kgiszczak","download_url":"https://codeload.github.com/kgiszczak/tomlib/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254485062,"owners_count":22078767,"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":["gem","ruby","toml","toml-generator","toml-parser","toml-parsing"],"created_at":"2024-08-01T05:00:25.287Z","updated_at":"2025-05-16T07:05:34.871Z","avatar_url":"https://github.com/kgiszczak.png","language":"C","funding_links":[],"categories":["C"],"sub_categories":[],"readme":"# Tomlib\n\nTomlib is a TOML parser and generator for Ruby. It uses native C extension based on\nfast and standards-compliant [tomlc99](https://github.com/cktan/tomlc99) parser.\n\n## Compliance\n\nTomlib is TOML v1.0 compliant.\nIt passes both [BurntSushi/toml-test](https://github.com/BurntSushi/toml-test) and\n[iarna/toml-spec-tests](https://github.com/iarna/toml-spec-tests).\n\n## Installation\n\nTomlib supports Ruby (MRI) 3.0+\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'tomlib'\n```\n\nAnd then execute:\n\n```\n$ bundle install\n```\n\nOr install it yourself as:\n\n```\n$ gem install tomlib\n```\n\n## Usage\n\nTo parse a TOML document use:\n\n```ruby\nrequire 'tomlib'\n\nTomlib.load(\u003c\u003c~TOML)\nfirstName = \"John\"\nlastName = \"Doe\"\nhobbies = [ \"Singing\", \"Dancing\" ]\n\n[address]\ncity = \"London\"\nzip = \"E1 6AN\"\n\n[address.street]\nname = \"Oxford Street\"\nTOML\n\n# =\u003e\n#\n# {\n#   \"firstName\" =\u003e \"John\",\n#   \"lastName\" =\u003e \"Doe\",\n#   \"hobbies\" =\u003e [\"Singing\", \"Dancing\"],\n#   \"address\" =\u003e {\n#     \"city\"=\u003e\"London\",\n#     \"zip\"=\u003e\"E1 6AN\",\n#     \"street\"=\u003e{ \"name\"=\u003e\"Oxford Street\" }\n#   }\n# }\n```\n\nTo generate a TOML document from Ruby Hash use:\n\n```ruby\nrequire 'tomlib'\n\nTomlib.dump({\n  \"firstName\" =\u003e \"John\",\n  \"lastName\" =\u003e \"Doe\",\n  \"hobbies\" =\u003e [\"Singing\", \"Dancing\"],\n  \"address\" =\u003e {\n    \"city\"=\u003e\"London\",\n    \"zip\"=\u003e\"E1 6AN\",\n    \"street\"=\u003e{ \"name\"=\u003e\"Oxford Street\" }\n  }\n})\n\n# =\u003e\n#\n# firstName = \"John\"\n# lastName = \"Doe\"\n# hobbies = [ \"Singing\", \"Dancing\" ]\n#\n# [address]\n# city = \"London\"\n# zip = \"E1 6AN\"\n#\n#   [address.street]\n#   name = \"Oxford Street\"\n```\n\nIf you don't need indentation use:\n\n```ruby\nrequire 'tomlib'\n\nTomlib.dump(hash, indent: false)\n\n# =\u003e\n#\n# firstName = \"John\"\n# lastName = \"Doe\"\n# hobbies = [ \"Singing\", \"Dancing\" ]\n#\n# [address]\n# city = \"London\"\n# zip = \"E1 6AN\"\n#\n# [address.street]\n# name = \"Oxford Street\"\n```\n\n## Performance\n\nWhen parsing documents, `Tomlib` is more than 600x (400x with yjit) faster than `toml-rb`,\n23x (17x with yjit) faster than `Tomlrb` and almost 5x (3.5x with yjit)\nfaster than `perfect_toml` (~5KB TOML document size).\n\nWhen generating TOML documents, it is about 1.5x (1.7x with yjit) faster than `toml-rb`.\n\nFor full comparison take a look at\n[benchmarks](https://github.com/kgiszczak/tomlib/tree/master/benchmarks)\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at https://github.com/kgiszczak/tomlib.\n\n## License\n\nThe gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkgiszczak%2Ftomlib","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkgiszczak%2Ftomlib","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkgiszczak%2Ftomlib/lists"}