{"id":25668156,"url":"https://github.com/kfischer-okarin/hoard","last_synced_at":"2025-07-02T21:04:35.825Z","repository":{"id":77666775,"uuid":"399990644","full_name":"kfischer-okarin/hoard","owner":"kfischer-okarin","description":"Serialize/Deserialize arbitrarily complex values in your DragonRuby games.","archived":false,"fork":false,"pushed_at":"2021-11-11T07:54:00.000Z","size":32,"stargazers_count":2,"open_issues_count":2,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-24T10:37:38.853Z","etag":null,"topics":["dragonruby","serialization"],"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/kfischer-okarin.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":"2021-08-26T00:15:25.000Z","updated_at":"2021-10-30T05:26:09.000Z","dependencies_parsed_at":"2023-02-27T15:15:37.296Z","dependency_job_id":null,"html_url":"https://github.com/kfischer-okarin/hoard","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/kfischer-okarin/hoard","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kfischer-okarin%2Fhoard","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kfischer-okarin%2Fhoard/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kfischer-okarin%2Fhoard/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kfischer-okarin%2Fhoard/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kfischer-okarin","download_url":"https://codeload.github.com/kfischer-okarin/hoard/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kfischer-okarin%2Fhoard/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263215257,"owners_count":23431887,"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":["dragonruby","serialization"],"created_at":"2025-02-24T10:28:45.976Z","updated_at":"2025-07-02T21:04:35.773Z","avatar_url":"https://github.com/kfischer-okarin.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Hoard\n\n[![MIT License][license-shield]][license-url]\n![Tests Status][tests-shield]\n\n\n- [About](#about)\n- [Installation](#installation)\n- [Usage](#usage)\n- [Roadmap](#roadmap)\n- [Contributing](#contributing)\n- [Contact](#contact)\n\n\n## About\n\nThe built-in serialization/deserialization functions of DragonRuby fail when used with moderately big data.\n\nWith Hoard you can serialize and deserialize arbitrarily big data without having to think about splitting them into \nmanageable small pieces.\n\n\n## Installation\n\n### Via Smaug\n\nAdd following line to your `Smaug.toml`:\n```toml\nhoard =  \"https://github.com/kfischer-okarin/hoard/releases/download/v1.0.0/hoard.zip\"\n```\n\nAlternatively you can also just run `smaug add hoard` though that will add the whole repository to your project.\n\n### Manually\n\nDownload the [current release][current-release-url], extract it,\nand put the contained `lib/hoard.rb` anywhere in your game folder and require it.\n\n\n## Usage\n\nTo serialize data:\n```rb\nserialized_data = Hoard.serialize save_game_data\n\n# Save the data\n$gtk.write_file 'saves/001.sav', serialized_data\n```\n\nTo deserialize data:\n```rb\nserialized_data = $gtk.read_file 'saves/001.sav'\n\nsave_game_data = Hoard.deserialize serialized_data\n```\n\n### Supported Data Types\n- Integers\n- Strings\n- Symbols\n- Boolean values\n- Arrays for serializable values\n- Hashes with serializable keys/values\n\n### Caution\n\nEntities created by `args.state.new_entity` or `args.state.new_entity_strict` are serialized/deserialized as a whole.\nSo if a single entity is very big it could still mean that your data cannot be properly deserialized (DragonRuby will\nprint out a warning in that case). \n\nTherefore if you need to serialize huge units of data it might be better to use Hashes.\n\n### Define your own Serializer\n\nA serializer is a class derived from `Hoard::Serializer::BaseSerializer` that defines several class methods as below.\n\n```rb\nclass MySerializer \u003c Hoard::Serializer::BaseSerializer\n  class \u003c\u003c self\n    def type\n      # Return a unique symbol identifier for your serializer\n    end\n\n    def can_serialize?(value)\n      # Return true if the value can be serialized by your serializer\n    end\n\n    def serialize(value)\n      # Return a serialized string representation of your data\n    end\n\n    def deserialize(serialized_value)\n      # Return the deserialized data\n    end\n  end\nend\n```\n\nYou can check the implementations of the [default serializers][default-serializers-source-url] if you need more details.\n\n\n## Roadmap\n\nSee the [open issues][issues-url] for a list of proposed features (and known issues).\n\n\n## Contributing\n\nThank your for your willingness to help out with the development!\n\nIf you have any contributions, please fork the repository, add your changes to a feature branch and open\na Pull Request.\n\n\n## Contact\n\nYou can find me usually on the [DragonRuby Discord][dragonruby-discord-url] under the username \n`kfischer_okarin`.\n\n\n[license-shield]: https://img.shields.io/github/license/kfischer-okarin/hoard\n[license-url]: https://github.com/kfischer-okarin/hoard/blob/main/LICENSE\n[tests-shield]: https://github.com/kfischer-okarin/hoard/actions/workflows/tests.yml/badge.svg\n[current-release-url]: https://github.com/kfischer-okarin/hoard/releases/download/v1.0.0/hoard.zip\n[default-serializers-source-url]: https://github.com/kfischer-okarin/hoard/tree/main/lib/hoard/serializer\n[issues-url]: https://github.com/kfischer-okarin/hoard/issues\n[dragonruby-discord-url]: https://discord.dragonruby.org\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkfischer-okarin%2Fhoard","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkfischer-okarin%2Fhoard","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkfischer-okarin%2Fhoard/lists"}