{"id":23398279,"url":"https://github.com/mattruggio/nay","last_synced_at":"2025-10-04T12:48:50.934Z","repository":{"id":56885192,"uuid":"460715860","full_name":"mattruggio/nay","owner":"mattruggio","description":"Lightweight and simple string templating library","archived":false,"fork":false,"pushed_at":"2022-06-10T15:56:46.000Z","size":29,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-09-22T07:59:24.157Z","etag":null,"topics":["ruby","string-template","templating"],"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/mattruggio.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-02-18T04:59:54.000Z","updated_at":"2025-03-30T00:49:02.000Z","dependencies_parsed_at":"2022-08-20T13:00:06.386Z","dependency_job_id":null,"html_url":"https://github.com/mattruggio/nay","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/mattruggio/nay","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mattruggio%2Fnay","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mattruggio%2Fnay/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mattruggio%2Fnay/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mattruggio%2Fnay/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mattruggio","download_url":"https://codeload.github.com/mattruggio/nay/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mattruggio%2Fnay/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278315190,"owners_count":25966774,"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-04T02:00:05.491Z","response_time":63,"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":["ruby","string-template","templating"],"created_at":"2024-12-22T09:38:21.399Z","updated_at":"2025-10-04T12:48:50.920Z","avatar_url":"https://github.com/mattruggio.png","language":"Ruby","readme":"# Nay\n\n#### Lightweight and simple string templating library\n\n[![Gem Version](https://badge.fury.io/rb/nay.svg)](https://badge.fury.io/rb/nay) [![Ruby Gem CI](https://github.com/mattruggio/nay/actions/workflows/rubygem.yml/badge.svg)](https://github.com/mattruggio/nay/actions/workflows/rubygem.yml) [![Maintainability](https://api.codeclimate.com/v1/badges/4703f8c46f94685afc29/maintainability)](https://codeclimate.com/github/mattruggio/nay/maintainability) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n\nSupplies a simple interface for evaluating string templates with objects.\n\n## Installation\n\nTo install through Rubygems:\n\n````\ngem install nay\n````\n\nYou can also add this to your Gemfile using:\n\n````\nbundle add nay\n````\n\n## Examples\n\n### Simple String-based Expression\n\n````ruby\nanimal = {\n  'animal' =\u003e {\n    'speed' =\u003e 'quick',\n    'type' =\u003e 'fox'\n  }\n}\n\nstring   = 'A \u003c\u003c animal.speed \u003e\u003e \u003c\u003c animal.type \u003e\u003e jumps over the fence!'\ncompiled = Nay.evaluate(string, animal)\n````\n\nThis would set `compiled` to: 'A quick fox jumps over the fence!'`\n\nNotes:\n\n* Tokens are passed through #[] method for the passed in object.  Any object providing a brackets interface will work.\n* A valid token only contains the following characters: [a-zA-Z0-9_-]. If a token needs to contain something not in that list then qualify it with double quotes (i.e. `hello, \u003c\u003c person.\"first name\" \u003e\u003e`)\n\n### More Complex Expressions\n\nExpressions are not limited to just being a string.  Here are the basic heuristics:\n\n* hash: then each key and value are recursively traversed\n* array: then each entry is recursively traversed\n* string: evaluated with parameters\n* anything not a hash, array, or string: do nothing\n\nAn example of this would be a somewhat complicated object:\n\n````ruby\nobject = {\n  '\u003c\u003c id_key \u003e\u003e' =\u003e '\u003c\u003c id \u003e\u003e',\n  'pets' =\u003e [\n    '\u003c\u003c pets.\"pet 1\" \u003e\u003e',\n    '\u003c\u003c pets.\"pet 2\" \u003e\u003e'\n  ],\n  zyx: :vut\n}\n\nparameters = {\n  'id_key' =\u003e 'id',\n  'id' =\u003e 123,\n  'pets' =\u003e {\n    'pet 1' =\u003e 'dog',\n    'pet 2' =\u003e 'cat'\n  },\n  zyx: :vut\n}\n\nevaluated_object = Nay.evaluate(object, parameters)\n````\n\nIn the above example evaluated_object would be equivalent to:\n\n````ruby\n{\n  'id' =\u003e '123',\n  'pets' =\u003e [\n    'dog',\n    'cat'\n  ],\n  zyx: :vut\n}\n````\n\nNotes:\n\n* A hash, hash key, and hash value are represented here\n* An array with entries are represented here\n* A non-string is represented here (as the zyx/vut key/value)\n\n## Contributing\n\n### Development Environment Configuration\n\nBasic steps to take to get this repository compiling:\n\n1. Install [Ruby](https://www.ruby-lang.org/en/documentation/installation/) (check nay.gemspec for versions supported)\n2. Install bundler (gem install bundler)\n3. Clone the repository (git clone git@github.com:mattruggio/nay.git)\n4. Navigate to the root folder (cd nay)\n5. Install dependencies (bundle)\n\n### Running Tests\n\nTo execute the test suite run:\n\n````zsh\nbin/rspec spec --format documentation\n````\n\nAlternatively, you can have Guard watch for changes:\n\n````zsh\nbin/guard\n````\n\nAlso, do not forget to run Rubocop:\n\n````zsh\nbin/rubocop\n````\n\nAnd auditing the dependencies:\n\n````zsh\nbin/bundler-audit check --update\n````\n\n### Publishing\n\nNote: ensure you have proper authorization before trying to publish new versions.\n\nAfter code changes have successfully gone through the Pull Request review process then the following steps should be followed for publishing new versions:\n\n1. Merge Pull Request into main\n2. Update `version.rb` using [semantic versioning](https://semver.org/)\n3. Install dependencies: `bundle`\n4. Update `CHANGELOG.md` with release notes\n5. Commit \u0026 push main to remote and ensure CI builds main successfully\n6. Run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).\n\n## Code of Conduct\n\nEveryone interacting in this codebase, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/mattruggio/nay/blob/main/CODE_OF_CONDUCT.md).\n\n## License\n\nThis project is MIT Licensed.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmattruggio%2Fnay","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmattruggio%2Fnay","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmattruggio%2Fnay/lists"}