{"id":22808260,"url":"https://github.com/sixarm/sixarm_ruby_pathname_dirnames","last_synced_at":"2025-03-30T21:15:24.234Z","repository":{"id":2800894,"uuid":"3801506","full_name":"SixArm/sixarm_ruby_pathname_dirnames","owner":"SixArm","description":"SixArm.com » Ruby » Pathname#dirnames method to iterate on parent directories","archived":false,"fork":false,"pushed_at":"2023-09-15T19:28:47.000Z","size":254,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-02-06T00:24:38.490Z","etag":null,"topics":["dirname","gem","pathname","ruby"],"latest_commit_sha":null,"homepage":"http://sixarm.com","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/SixArm.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGES.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":"CODEOWNERS","security":null,"support":null,"governance":null}},"created_at":"2012-03-22T19:41:56.000Z","updated_at":"2023-05-22T14:12:27.000Z","dependencies_parsed_at":"2023-07-06T01:45:34.431Z","dependency_job_id":null,"html_url":"https://github.com/SixArm/sixarm_ruby_pathname_dirnames","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SixArm%2Fsixarm_ruby_pathname_dirnames","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SixArm%2Fsixarm_ruby_pathname_dirnames/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SixArm%2Fsixarm_ruby_pathname_dirnames/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SixArm%2Fsixarm_ruby_pathname_dirnames/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SixArm","download_url":"https://codeload.github.com/SixArm/sixarm_ruby_pathname_dirnames/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246379366,"owners_count":20767696,"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":["dirname","gem","pathname","ruby"],"created_at":"2024-12-12T11:08:53.166Z","updated_at":"2025-03-30T21:15:24.210Z","avatar_url":"https://github.com/SixArm.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SixArm.com → Ruby → \u003cbr\u003e Pathname#dirnames method to iterate on parent directories\n\n* Doc: \u003chttp://sixarm.com/sixarm_ruby_pathname_dirnames/doc\u003e\n* Gem: \u003chttp://rubygems.org/gems/sixarm_ruby_pathname_dirnames\u003e\n* Repo: \u003chttp://github.com/sixarm/sixarm_ruby_pathname_dirnames\u003e\n\u003c!--header-shut--\u003e\n\n\n## Introduction\n\nThis gem has one method: Pathname#dirnames.\n\nIt will return an enumerable of pathnames created by calling #dirname repeatedly.\n\nThis can be useful for traversing directories upwards to parent, grandparent, etc.\n\nExample:\n\n     p = Pathname.new('/foo/goo/hoo.txt')\n     p.dirnames\n     #=\u003e ['/foo/goo', '/foo', '/']\n\nFor docs go to \u003chttp://sixarm.com/sixarm_ruby_pathname_dirnames/doc\u003e\n\nWant to help? We're happy to get pull requests.\n\n\n\u003c!--install-open--\u003e\n\n## Install\n\n### Gem\n\nTo install this gem in your shell or terminal:\n\n    gem install sixarm_ruby_pathname_dirnames\n\n### Gemfile\n\nTo add this gem to your Gemfile:\n\n    gem 'sixarm_ruby_pathname_dirnames'\n\n### Require\n\nTo require the gem in your code:\n\n    require 'sixarm_ruby_pathname_dirnames'\n\n\u003c!--install-shut--\u003e\n\n\n## Example to find a file\n\nTo find the first occurance of a file named \"my.txt\" in a path or its parents:\n\n     basename = \"my.txt\"\n     p = Pathname.new('/foo/goo/hoo/*')\n     puts p.dirnames.find{|dirname| (dirname + basename).exist?}\n\nNote that the \"*\" at the end of the pathname is to give dirname something to chop off; the \"*\" is being used as chaff, not as a file matcher nor string matches.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsixarm%2Fsixarm_ruby_pathname_dirnames","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsixarm%2Fsixarm_ruby_pathname_dirnames","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsixarm%2Fsixarm_ruby_pathname_dirnames/lists"}