{"id":26241567,"url":"https://github.com/a6b8/local-path-builder-for-ruby","last_synced_at":"2025-06-27T01:33:11.027Z","repository":{"id":56881809,"uuid":"378757073","full_name":"a6b8/local-path-builder-for-ruby","owner":"a6b8","description":"Build all paths in one hash to local files and folders.","archived":false,"fork":false,"pushed_at":"2022-01-22T01:40:12.000Z","size":56,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-17T18:04:46.104Z","etag":null,"topics":["data-science","localstorage","ruby","rubygems"],"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/a6b8.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-06-20T23:16:55.000Z","updated_at":"2022-01-01T18:00:57.000Z","dependencies_parsed_at":"2022-08-20T23:40:53.701Z","dependency_job_id":null,"html_url":"https://github.com/a6b8/local-path-builder-for-ruby","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/a6b8/local-path-builder-for-ruby","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/a6b8%2Flocal-path-builder-for-ruby","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/a6b8%2Flocal-path-builder-for-ruby/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/a6b8%2Flocal-path-builder-for-ruby/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/a6b8%2Flocal-path-builder-for-ruby/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/a6b8","download_url":"https://codeload.github.com/a6b8/local-path-builder-for-ruby/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/a6b8%2Flocal-path-builder-for-ruby/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262172805,"owners_count":23270106,"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":["data-science","localstorage","ruby","rubygems"],"created_at":"2025-03-13T08:32:12.363Z","updated_at":"2025-06-27T01:33:11.007Z","avatar_url":"https://github.com/a6b8.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ca href=\"#table-of-contents\"\u003e\n\u003cimg src=\"https://raw.githubusercontent.com/a6b8/a6b8/main/assets/headlines/custom/local-path-builder-for-ruby.svg\" height=\"45px\" name=\"# Local Path Builder for Ruby\" alt=\"Local Path Builder for Ruby\"\u003e\n\u003c/a\u003e\n\nUsefull helper to build all paths in one hash to local files and folders.\n\n\u003cbr\u003e\n\n\u003ca href=\"#table-of-contents\"\u003e\n\u003cimg src=\"https://raw.githubusercontent.com/a6b8/a6b8/main/assets/headlines/default/examples.svg\" height=\"45px\" name=\"examples\" alt=\"Examples\"\u003e\n\u003c/a\u003e\n\u003cbr\u003e\n\n\n\u003ca href=\"#headline\"\u003e\n\u003cimg src=\"https://raw.githubusercontent.com/a6b8/a6b8/main/assets/headlines/default/table-of-contents.svg\" height=\"45px\" name=\"table-of-contents\" alt=\"Table of Contents\"\u003e\n\u003c/a\u003e\n\u003cbr\u003e\n\n1. [Quickstart](#quickstart) \n2. [Setup](#setup)\n3. [Methods](#methods)\n4. [Tree Structure](#tree-structure)\n5. [Console Output](#console)\n6. [Contributing](#contributing)\n7. [Limitations](#limitations)\n8. [License](#license)\n9. [Code of Conduct](#code-of-conduct)\n10. [Support my Work](#support-my-work)\n\n\u003cbr\u003e\n\n\u003ca href=\"#table-of-contents\"\u003e\n\u003cimg src=\"https://raw.githubusercontent.com/a6b8/a6b8/main/assets/headlines/default/quickstart.svg\" height=\"45px\" name=\"quickstart\" alt=\"Quickstart\"\u003e\n\u003c/a\u003e\n\n```ruby\nrequire 'local_path_builder'\n\nstruct = LocalPathBuilder.helper()\nLocalPathBuilder.generate( struct, :both )\n```\n\n\u003cbr\u003e\n\n\u003ca href=\"#table-of-contents\"\u003e\n\u003cimg src=\"https://raw.githubusercontent.com/a6b8/a6b8/main/assets/headlines/default/setup.svg\" height=\"45px\" name=\"setup\" alt=\"Setup\"\u003e\n\u003c/a\u003e\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'local_path_builder'\n```\n\nAnd then execute:\n\n    $ bundle install\n\nOr install it yourself as:\n\n    $ gem install local_path_builder\n\n\nOn Rubygems: \n- Gem: https://rubygems.org/gems/local_path_builder\n- Profile: https://rubygems.org/profiles/a6b8\n\n\u003cbr\u003e\n\n\u003ca href=\"#table-of-contents\"\u003e\n\u003cimg src=\"https://raw.githubusercontent.com/a6b8/a6b8/main/assets/headlines/default/methods.svg\" height=\"45px\" name=\"methods\" alt=\"Methods\"\u003e\n\u003c/a\u003e\n\n### .helper()\n\n```ruby\nrequire 'local_path_builder'\n\nhash = LocalPathBuilder.helper()\n# =\u003e { path: \n```\n\n### .generate( struct[:path], key )\n\n```ruby\nrequire 'local_path_builder'\n\nhash = LocalPathBuilder.generate( \n    path_tree, \n    console_mode,  \n    salt \n)\n```\n\n**Input**\n| **Type** | **Required** | **Description** | **Example** | **Description** |\n|------:|:------|:------|:------|:------| \n| **path tree** | ```Hash``` | Yes | please refer `path structure` | Define path structure |\n| **console mode** | ```Symbol``` | Yes | ```:hash``` | Set console output mode. Use ```:silent```, ```:hash```, ```:path``` or ```:both``` |\n| **salt** | ```String``` | No | ```'1624262108'``` | Use salt to create unique filenames. |\n\n**Return**\u003cbr\u003e\nHash (See also Console Output)\n\n\u003cbr\u003e\n\n\u003ca href=\"#table-of-contents\"\u003e\n\u003cimg src=\"https://raw.githubusercontent.com/a6b8/a6b8/main/assets/headlines/default/tree-structure.svg\" height=\"45px\" name=\"tree-structure\" alt=\"Tree Structure\"\u003e\n\u003c/a\u003e\n\nA struct input is required to generate all paths. Use the following as reference to design your own tree\n\n**Example Tree**\n\n```ruby\n{\n    root: './',\n    name: '1',\n    children: {\n    entry: {\n        name: '0-entry',\n        files: {\n        tsv: {\n            name: 'rest-{{SALT}}.tsv',\n        }\n        }\n    },\n    converted: {\n        name: '1-converted',\n        children: {\n            json_folder: {\n                name: '0-json',\n                files: {\n                    json: {\n                        name: 'data-{{SALT}}.json',\n                    }\n                }\n            },\n            tsv_folder: {\n                name: '0-tsv',\n                files: {\n                    tsv: {\n                        name: 'data-{{SALT}}.json',\n                    }\n                }\n            }\n        },\n        files: {\n        json: {\n            name: 'data-{{SALT}}.json',\n        } \n        }\n    }\n    }\n}\n```\n```LocalPathBuiler.helper()``` will give you the same output.\n\n\u003cbr\u003e\n\n\u003ca href=\"#table-of-contents\"\u003e\n\u003cimg src=\"https://raw.githubusercontent.com/a6b8/a6b8/main/assets/headlines/default/console.svg\" height=\"45px\" name=\"console\" alt=\"Console Output\"\u003e\n\u003c/a\u003e\n\nThe second parameter of the ```.generate()``` function expects a symbol. you can choose between ```:silent```, ```:hash```, ```path``` and ```both```. \n\n### :silent\nConsole stays silent.\n\n### :hash\nConsole log all variables which are available.\n\n```txt\nLocalPathBuilder.generate( struct, :hash )\n\nTREE OVERVIEW\n    hash[:path][:full]\n    ┗━ hash[:path][:children][:entry][:full]\n    ┗━ hash[:path][:children][:entry][:files][:tsv][:full]\n    ┗━ hash[:path][:children][:converted][:full]\n    ┗━ hash[:path][:children][:converted][:files][:json][:full]\n        ┗━ hash[:path][:children][:converted][:children][:json_folder][:full]\n        ┗━ hash[:path][:children][:converted][:children][:json_folder][:files][:json][:full]\n        ┗━ hash[:path][:children][:converted][:children][:tsv_folder][:full]\n        ┗━ hash[:path][:children][:converted][:children][:tsv_folder][:files][:tsv][:full]\n```\n\n\n### :path\nConsole log all path which were created.\n\n```\nLocalPathBuilder.generate( struct, :path )\n\nTREE OVERVIEW\n    ./1/\n        ./1/0-entry/\n        ./1/0-entry/rest-1624263104.tsv\n        ./1/1-converted/\n        ./1/1-converted/data-1624263104.json\n            ./1/1-converted/0-json/\n            ./1/1-converted/0-json/data-1624263104.json\n            ./1/1-converted/0-tsv/\n            ./1/1-converted/0-tsv/data-1624263104.json\n```\n\n\n### :both\nConsole log hash variable and the corresponding file path.\n\n```txt\nLocalPathBuilder.generate( struct, :both )\n\nTREE OVERVIEW\n    hash[:path][:full]\n    ./1/\n    ┗━ hash[:path][:children][:entry][:full]\n        ./1/0-entry/\n    ┗━ hash[:path][:children][:entry][:files][:tsv][:full]\n        ./1/0-entry/rest-1624263104.tsv\n    ┗━ hash[:path][:children][:converted][:full]\n        ./1/1-converted/\n    ┗━ hash[:path][:children][:converted][:files][:json][:full]\n        ./1/1-converted/data-1624263104.json\n        ┗━ hash[:path][:children][:converted][:children][:json_folder][:full]\n            ./1/1-converted/0-json/\n        ┗━ hash[:path][:children][:converted][:children][:json_folder][:files][:json][:full]\n            ./1/1-converted/0-json/data-1624263104.json\n        ┗━ hash[:path][:children][:converted][:children][:tsv_folder][:full]\n            ./1/1-converted/0-tsv/\n        ┗━ hash[:path][:children][:converted][:children][:tsv_folder][:files][:tsv][:full]\n            ./1/1-converted/0-tsv/data-1624263104.json\n```\n\n\u003cbr\u003e\n\n\u003ca href=\"#table-of-contents\"\u003e\n\u003cimg src=\"https://raw.githubusercontent.com/a6b8/a6b8/main/assets/headlines/default/contributing.svg\" height=\"45px\" name=\"contributing\" alt=\"Contributing\"\u003e\n\u003c/a\u003e\n\nBug reports and pull requests are welcome on GitHub at https://github.com/a6b8/statosio-for-wordpress. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/a6b8/statosio/blob/master/CODE_OF_CONDUCT.md).\n\n\u003cbr\u003e\n\n\u003ca href=\"#table-of-contents\"\u003e\n\u003cimg src=\"https://raw.githubusercontent.com/a6b8/a6b8/main/assets/headlines/default/limitations.svg\" height=\"45px\" name=\"limitations\" alt=\"Limitations\"\u003e\n\u003c/a\u003e\n\n- Only three levels of folders are supported\n  \n\u003cbr\u003e\n\n\u003ca href=\"#table-of-contents\"\u003e\n\u003cimg src=\"https://raw.githubusercontent.com/a6b8/a6b8/main/assets/headlines/default/credits.svg\" height=\"45px\" name=\"credits\" alt=\"Credits\"\u003e\n\u003c/a\u003e\n\n\u003cbr\u003e\n\n\u003ca href=\"#table-of-contents\"\u003e\n\u003cimg src=\"https://raw.githubusercontent.com/a6b8/a6b8/main/assets/headlines/default/license.svg\" height=\"45px\" name=\"license\" alt=\"License\"\u003e\n\u003c/a\u003e\n\nThe gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).\n\n\u003cbr\u003e\n\n\u003ca href=\"#table-of-contents\"\u003e\n\u003cimg src=\"https://raw.githubusercontent.com/a6b8/a6b8/main/assets/headlines/default/code-of-conduct.svg\" height=\"45px\" name=\"code-of-conduct\" alt=\"Code of Conduct\"\u003e\n\u003c/a\u003e\n    \nEveryone interacting in the LocalPathBuilder project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/a6b8/local-path-builder-for-ruby/blob/master/CODE_OF_CONDUCT.md).\n\n\u003cbr\u003e\n\n\u003ca href=\"#table-of-contents\"\u003e\n\u003cimg href=\"#table-of-contents\" src=\"https://raw.githubusercontent.com/a6b8/a6b8/main/assets/headlines/default/star-us.svg\" height=\"45px\" name=\"star-us\" alt=\"Star us\"\u003e\n\u003c/a\u003e\n\nPlease ⭐️ star this Project, every ⭐️ star makes us very happy!","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fa6b8%2Flocal-path-builder-for-ruby","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fa6b8%2Flocal-path-builder-for-ruby","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fa6b8%2Flocal-path-builder-for-ruby/lists"}