Method: PathList::Walkers::GitignoreCollectingFileSystem#allowed?

Defined in:
lib/path_list/walkers/gitignore_collecting_file_system.rb

#allowed?(path, directory: nil, content: nil) ⇒ Boolean

Returns:



10
11
12
13
14
15
16
17
18
19
20
# File 'lib/path_list/walkers/gitignore_collecting_file_system.rb', line 10

def allowed?(path, directory: nil, content: nil)
  full_path = ::File.expand_path(path)
  return false if directory.nil? ? ::File.lstat(full_path).directory? : directory

  @rule_groups.add_gitignore_to_root(full_path)

  candidate = ::PathList::RootCandidate.new(full_path, nil, directory, content)
  @rule_groups.allowed_recursive?(candidate)
rescue ::Errno::ENOENT, ::Errno::EACCES, ::Errno::ENOTDIR, ::Errno::ELOOP, ::Errno::ENAMETOOLONG
  false
end