class PathList

Constants

VERSION

Public Class Methods

new(root: nil, gitignore: :auto, **rule_group_builder_args) click to toggle source

:nocov:

# File lib/path_list.rb, line 38
def initialize(root: nil, gitignore: :auto, **rule_group_builder_args)
  @root = "#{::File.expand_path(root.to_s, Dir.pwd)}/"
  rule_groups = ::PathList::RuleGroups.new(root: @root, gitignore: gitignore, **rule_group_builder_args)

  walker_class = gitignore ? ::PathList::Walkers::GitignoreCollectingFileSystem : ::PathList::Walkers::FileSystem
  @walker = walker_class.new(rule_groups)
  freeze
end

Public Instance Methods

===(path, directory: nil, content: nil)
Alias for: allowed?
allowed?(path, directory: nil, content: nil) click to toggle source
# File lib/path_list.rb, line 47
def allowed?(path, directory: nil, content: nil)
  @walker.allowed?(path, directory: directory, content: content)
end
Also aliased as: ===
each(root = ::Dir.pwd, &block) click to toggle source
# File lib/path_list.rb, line 56
def each(root = ::Dir.pwd, &block)
  return enum_for(:each, root) unless block_given?

  root = "#{::File.expand_path(root.to_s, Dir.pwd)}/"
  @walker.each(root, '', &block)
end
to_proc() click to toggle source
# File lib/path_list.rb, line 52
def to_proc
  method(:allowed?).to_proc
end