chef

https://github.com/opscode/chef

Ruby

A systems integration framework, built to bring the benefits of configuration management to your entire infrastructure.

Chef::ChefFS::FilePattern#exact_child_name_under

Returns the immediate child of a path that would be matched
if this FilePattern was applied.  If more than one child
could match, this method returns nil.

==== Attributes

* +path+ - The path to look for an exact child name under.

==== Returns

The next directory in the pattern under the given path.
If the directory part could match more than one child, it
returns +nil+.

==== Examples

  abc/def.exact_child_name_under('abc') == 'def'
  abc/def/ghi.exact_child_name_under('abc') == 'def'
  abc/*/ghi.exact_child_name_under('abc') == nil
  abc/*/ghi.exact_child_name_under('abc/def') == 'ghi'
  abc/**/ghi.exact_child_name_under('abc/def') == nil

This method assumes +could_match_children?(path)+ is +true+.

Source | Google | Stack overflow

Edit

git clone [email protected]:opscode/chef.git

cd chef

open lib/chef/chef_fs/file_pattern.rb

Contribute

# Make a new branch

git checkout -b -your-name--update-docs-Chef--ChefFS--FilePattern-exact_child_name_under-for-pr


# Commit to git

git add lib/chef/chef_fs/file_pattern.rbgit commit -m "better docs for Chef::ChefFS::FilePattern#exact_child_name_under"


# Open pull request

gem install hub # on a mac you can `brew install hub`

hub fork

git push <your name> -your-name--update-docs-Chef--ChefFS--FilePattern-exact_child_name_under-for-pr

hub pull-request


# Celebrate!