{"id":22213365,"url":"https://github.com/jeffnyman/data_set","last_synced_at":"2026-04-30T17:31:55.091Z","repository":{"id":62556775,"uuid":"76079181","full_name":"jeffnyman/data_set","owner":"jeffnyman","description":"Provides configuration specification and retrieval using YAML files.","archived":false,"fork":false,"pushed_at":"2019-09-20T12:58:12.000Z","size":17,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-04-27T20:08:45.438Z","etag":null,"topics":["yaml"],"latest_commit_sha":null,"homepage":null,"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/jeffnyman.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-12-09T23:54:38.000Z","updated_at":"2019-09-20T12:58:14.000Z","dependencies_parsed_at":"2022-11-03T06:00:49.689Z","dependency_job_id":null,"html_url":"https://github.com/jeffnyman/data_set","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/jeffnyman/data_set","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jeffnyman%2Fdata_set","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jeffnyman%2Fdata_set/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jeffnyman%2Fdata_set/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jeffnyman%2Fdata_set/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jeffnyman","download_url":"https://codeload.github.com/jeffnyman/data_set/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jeffnyman%2Fdata_set/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32472396,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-30T13:12:12.517Z","status":"ssl_error","status_checked_at":"2026-04-30T13:12:06.837Z","response_time":57,"last_error":"SSL_read: 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":["yaml"],"created_at":"2024-12-02T21:09:31.499Z","updated_at":"2026-04-30T17:31:55.068Z","avatar_url":"https://github.com/jeffnyman.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# DataSet\n\n[![Gem Version](https://badge.fury.io/rb/data_set.svg)](http://badge.fury.io/rb/data_set)\n[![License](http://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/jeffnyman/data_set/blob/master/LICENSE.md)\n\nDataSet provides an easy mechanism to load up a set of data from a YAML file and then access that data by the structuring keys of the file. This provides an expressive way to retrieve data values.\n\n## Installation\n\nTo get the latest stable release, add this line to your application's Gemfile:\n\n```ruby\ngem 'data_set'\n```\n\nTo get the latest code:\n\n```ruby\ngem 'data_set', git: 'https://github.com/jeffnyman/data_set'\n```\n\nAfter doing one of the above, execute the following command:\n\n```\n$ bundle\n```\n\nYou can also install DataSet just as you would any other gem:\n\n```\n$ gem install data_set\n```\n\n## Usage\n\nTo use DataSet you can either specify a directory and file for loading or rely on the defaults. By default, DataSet will look for files in a `data` directory relative to the executing script. Also by default, DataSet will read a file named `default.yml` from that directory. These defaults apply if you don't specify anything to the contrary.\n\nIf you want to use a different directory you can simply set the directory like this:\n\n```ruby\nDataSet.data_path = 'config'\n```\n\nIf you have a specific data file you want to load, you can specify it:\n\n```ruby\nDataSet.load('test_data.yml')\n```\n\nCalling the `load` method lets you begin to reference the data from that file. You can also specify a comma separated list of file names:\n\n```ruby\nDataSet.load('test_data.yml, accounts.yml, users.yml')\n```\n\nWhat DataSet is providing you is not just the loading of the file but a way to access the data directly by its name.\n\n### Data Accessors\n\nConsider a `test_data.yml` file with the following contents:\n\n```yaml\nhome_url: 'https://veilus.herokuapp.com'\nport: 9292\n\nauthentication:\n  username: admin\n  password: admin\n\nfirst:\n  second:\n    third: testing\n    fourth: xyzzy\n\nset_flag: true\ncleared_flag: false\ntest_symbol: :marvel\n```\n\nNow you can load this file and begin calling methods on the DataSet that match the keys from the file.\n\n```ruby\nDataSet.load('test_data.yml')\n\nputs DataSet.home_url\n```\n\nHere the last statement would return \"https://veilus.herokuapp.com\". Using this in context, I might do something like this:\n\n```ruby\nputs \"#{DataSet.home_url}/planets\"\n```\n\nYou can also supply default values which will be returned if the property does not exist in the file. For example:\n\n```ruby\nputs \"#{DataSet.home_url(\"http://localhost\")}:#{DataSet.port}/planets\"\n```\n\nHere `home_url` will be read from the file but, if it doesn't exist, the value provided to it will be used.\n\nYou can also access into the keys. For example, consider these statements:\n\n```ruby\nputs DataSet.authentication.username\nputs DataSet.first.second.third\n```\n\nThese statements would return the following based on the above data file:\n\n```\nadmin\ntesting\n```\n\nYou can also set an environment variable called `DATA_SET_FILE`. It's important to note that this is not a path. This is a file. The extent that this is useful depends on the context in which you slot it. Treating DataSet as an adjunct to an automated checking solution, for example, different machines that are using it could have different `DATA_SET_FILE` variables set. Or if using a tool like Cucumber, you could provide different profiles for execution like this:\n\n  ```yaml\ndefault:  DATA_SET_FILE=test.yml\nci:       DATA_SET_FILE=ci.yml\nstage:    DATA_SET_FILE=staging.yml\nprod:     DATA_SET_FILE=production.yml\n```\n\nThis would allow the specific environment variable to be set conditionally based on execution.\n\n## Development\n\nAfter checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec:all` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.\n\nThe default `rake` command will run all tests as well as a RuboCop analysis.\n\nTo install this gem onto your local machine, run `bundle exec rake install`.\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at [https://github.com/jeffnyman/data_set](https://github.com/jeffnyman/data_set). The testing ecosystem of Ruby is very large and this project is intended to be a welcoming arena for collaboration on yet another testing tool. As such, contributors are very much welcome but are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.\n\nTo contribute to DataSet:\n\n1. [Fork the project](http://gun.io/blog/how-to-github-fork-branch-and-pull-request/).\n2. Create your feature branch. (`git checkout -b my-new-feature`)\n3. Commit your changes. (`git commit -am 'new feature'`)\n4. Push the branch. (`git push origin my-new-feature`)\n5. Create a new [pull request](https://help.github.com/articles/using-pull-requests).\n\n## Author\n\n* [Jeff Nyman](http://testerstories.com)\n\n## Credits\n\nThis code is loosely based upon the [FigNewton](https://github.com/cheezy/fig_newton) gem. I created a new version largely to avoid the name \"FigNewton\" as well as cleaning up the code and the documentation.\n\n## License\n\nDataSet is distributed under the [MIT](http://www.opensource.org/licenses/MIT) license.\nSee the [LICENSE](https://github.com/jeffnyman/data_set/blob/master/LICENSE.md) file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjeffnyman%2Fdata_set","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjeffnyman%2Fdata_set","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjeffnyman%2Fdata_set/lists"}