{"id":20668609,"url":"https://github.com/nvoynov/sampler","last_synced_at":"2026-04-24T09:32:50.772Z","repository":{"id":262671426,"uuid":"887985219","full_name":"nvoynov/sampler","owner":"nvoynov","description":"Stupid simple ERB generator that reads JSON, turns it into OpenStruct and pass to ERB ","archived":false,"fork":false,"pushed_at":"2024-11-13T16:20:48.000Z","size":7,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-10T15:18:34.138Z","etag":null,"topics":["cli","erb","json","ruby"],"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/nvoynov.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"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":"2024-11-13T16:06:54.000Z","updated_at":"2024-11-13T16:20:51.000Z","dependencies_parsed_at":"2024-11-13T17:27:32.580Z","dependency_job_id":"9e150609-e151-419f-96a9-f92204e6ff9a","html_url":"https://github.com/nvoynov/sampler","commit_stats":null,"previous_names":["nvoynov/sampler"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/nvoynov/sampler","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nvoynov%2Fsampler","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nvoynov%2Fsampler/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nvoynov%2Fsampler/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nvoynov%2Fsampler/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nvoynov","download_url":"https://codeload.github.com/nvoynov/sampler/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nvoynov%2Fsampler/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32216920,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-24T08:24:32.376Z","status":"ssl_error","status_checked_at":"2026-04-24T08:24:26.731Z","response_time":64,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["cli","erb","json","ruby"],"created_at":"2024-11-16T20:09:59.185Z","updated_at":"2026-04-24T09:32:50.738Z","avatar_url":"https://github.com/nvoynov.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"% README.md\n\n`Sampler` provides the ability to render `ERB` templates based on models expressed in JSON file. The main idea is to turn JSON into `OpenStruct` and pass it to templates as `model` variable.\n\n# Usage\n\nRun `exe/sampler.rb` and see the options\n\n    $ ruby exe/sampler.rb\n\n# Model\n\nSampler reads JSON file and builds the tree of `OpenStruct` objects so fields that you see in the JSON become methods of the object.\n\nSuppose one has the following JSON:\n\n```json\n{\n  \"name\": \"Device\",\n  \"desc\": \"Device\",\n  \"classes\": [\n    {\n      \"name\": \"Memory Block\",\n      \"addresses\": [1, 2, 3]\n    }\n    {\n      \"name\": \"Identificatioin Page\",\n      \"addresses\": [1, 2, 3]\n    }\n  ]\n}\n```\n\nAfter parsing, it becomes full fledged Ruby object, where you can access JSON fields as methods:\n\n```ruby\nmodel.name\nmodel.desc\nmodel.classes.size\nmodel.classes.first.name\nmodel.classes.first.addresses\nmodel.classes.first.addresses.first\n```\n\n# Samples\n\nThe `samples` folder provides examples of JSON model, ERB template, and custom helper (`helper.rb`). All custom objects and functions placed in the helper will be available inside templates.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnvoynov%2Fsampler","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnvoynov%2Fsampler","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnvoynov%2Fsampler/lists"}