lib/chef_fs/file_pattern.rb
def exact_child_name_under(path)
      path = path[1,path.length-1] if !!(path =~ /^#{ChefFS::PathUtils::regexp_path_separator}/)
      dirs_in_path = ChefFS::PathUtils::split(path).length
      return nil if exact_parts.length <= dirs_in_path
      return exact_parts[dirs_in_path]
    end
def exact_child_name_under(path)
      path = path[1,path.length-1] if !!(path =~ /^#{ChefFS::PathUtils::regexp_path_separator}/)
      dirs_in_path = ChefFS::PathUtils::split(path).length
      return nil if exact_parts.length <= dirs_in_path
      return exact_parts[dirs_in_path]
    end
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+.