{"id":22120109,"url":"https://github.com/maxpleaner/persisted_hash","last_synced_at":"2025-03-24T06:26:21.408Z","repository":{"id":56887835,"uuid":"77074166","full_name":"MaxPleaner/persisted_hash","owner":"MaxPleaner","description":"Sync a hash's state with YAML file","archived":false,"fork":false,"pushed_at":"2016-12-22T10:18:15.000Z","size":63,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-10-31T02:25:24.538Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/MaxPleaner.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-12-21T17:54:11.000Z","updated_at":"2016-12-22T10:01:30.000Z","dependencies_parsed_at":"2022-08-21T00:50:43.476Z","dependency_job_id":null,"html_url":"https://github.com/MaxPleaner/persisted_hash","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MaxPleaner%2Fpersisted_hash","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MaxPleaner%2Fpersisted_hash/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MaxPleaner%2Fpersisted_hash/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MaxPleaner%2Fpersisted_hash/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MaxPleaner","download_url":"https://codeload.github.com/MaxPleaner/persisted_hash/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245219938,"owners_count":20579670,"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":[],"created_at":"2024-12-01T14:20:48.853Z","updated_at":"2025-03-24T06:26:21.370Z","avatar_url":"https://github.com/MaxPleaner.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"This was originally written in [gemmy](http://github.com/maxpleaner/gemmy) but was extracted to a gem.\n\nIt's on rubygems. To install `gem install persisted_hash` and `require 'persisted_hash'` as expected.\n\nThere are three potential ways to create a 'persisted hash':\n\n1. via a global patch on hash\n2. via a scoped refinement on hash\n3. functionally, via class method\n\nGlobally:\n\n```rb\nHash.include PersistedHash\nhash = {}.persisted(\"path.yaml\")\n```\n\nRefinements:\n\n```rb\nclass MyClass\n  using PersistedHash\n  hash = {}.persisted(\"path.yaml\")\nend\n```\n\nFunctionally:\n\n```rb\nhash = PersistedHash.new({})\n```\nThe API to interact with the persisted hash is as follows:\n\n- `get(*keys)` reads\n- `set(*keys)` writes\n- `data` get all\n- `set_state(hash)` overwrite\n- `clear` empty\n\nThe persisted object inherits from hash, so methods like `[]` can still be called.\nThey'll just work on the in-memory version, though. \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaxpleaner%2Fpersisted_hash","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmaxpleaner%2Fpersisted_hash","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaxpleaner%2Fpersisted_hash/lists"}