{"id":19133948,"url":"https://github.com/umbrellio/self_data","last_synced_at":"2025-05-06T19:23:04.664Z","repository":{"id":2836547,"uuid":"47173981","full_name":"umbrellio/self_data","owner":"umbrellio","description":"It's like native ruby DATA but you can use it not only for main file.","archived":false,"fork":false,"pushed_at":"2023-03-16T08:51:36.000Z","size":32,"stargazers_count":7,"open_issues_count":2,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-10-31T13:01:30.924Z","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":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/umbrellio.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2015-12-01T07:46:41.000Z","updated_at":"2023-10-12T19:59:13.000Z","dependencies_parsed_at":"2023-07-06T14:17:12.500Z","dependency_job_id":null,"html_url":"https://github.com/umbrellio/self_data","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/umbrellio%2Fself_data","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/umbrellio%2Fself_data/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/umbrellio%2Fself_data/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/umbrellio%2Fself_data/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/umbrellio","download_url":"https://codeload.github.com/umbrellio/self_data/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223793104,"owners_count":17203752,"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-11-09T06:24:30.125Z","updated_at":"2024-11-09T06:24:30.615Z","avatar_url":"https://github.com/umbrellio.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SelfData \u0026middot; [![Gem Version](https://badge.fury.io/rb/self_data.svg)](https://badge.fury.io/rb/self_data) [![Build Status](https://travis-ci.org/umbrellio/self_data.svg?branch=master)](https://travis-ci.org/umbrellio/self_data) [![Coverage Status](https://coveralls.io/repos/github/umbrellio/self_data/badge.svg)](https://coveralls.io/github/umbrellio/self_data)\n\nIt's like native ruby `DATA` but you can use it not only for main file.\n\n## Installation\n\n```ruby\n# Gemfile\ngem 'self_data'\n```\n\n```shell\n$ bundle install\n-- or --\n$ gem install self_data\n```\n\n```ruby\nrequire 'self_data'\n```\n\n## Synopsis\n\n```ruby\n# main.rb\n\nrequire 'self_data'\nrequire './a.rb'\n\nputs \"DATA: #{A.native_data}\"\nputs \"SelfData: #{A.self_data}\"\n\n__END__\nmain.rb data\n```\n\n```ruby\n# a.rb\n\nmodule A\n  module_function\n\n  def native_data\n    DATA.read\n  end\n\n  def self_data\n    SelfData.read\n  end\nend\n\n__END__\na.rb data\n```\n\nand if you execute it, you'll get:\n\n```shell\n$ ruby main.rb\nDATA: main.rb data\nSelfData: a.rb data\n```\n\n## Usage and Notes\n\nUse `SelfData.read()` to get text or use `SelfData.load(*formats, **options)` to get formatted data (like yaml, xml, erb, etc).\n\nLook at the [lib/self_data/config.rb](https://github.com/umbrellio/self_data/blob/master/lib/self_data/config.rb) for more details.\n\nSelfData uses `caller`, it's not fast, that's why you shouldn't use SelfData in loops.\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at https://github.com/umbrellio/self_data.\n\n## License\n\nReleased under MIT License.\n\n## Authors\n\nCreated by [7dr1v3](https://github.com/7dr1v3)\n\n\u003ca href=\"https://github.com/umbrellio/\"\u003e\n\u003cimg style=\"float: left;\" src=\"https://umbrellio.github.io/Umbrellio/supported_by_umbrellio.svg\" alt=\"Supported by Umbrellio\" width=\"439\" height=\"72\"\u003e\n\u003c/a\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fumbrellio%2Fself_data","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fumbrellio%2Fself_data","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fumbrellio%2Fself_data/lists"}