Class: Utils::ConfigFile::FileFinder

Inherits:
BlockConfig show all
Defined in:
lib/utils/config_file.rb

Overview

A configuration class for file system operations.

This class manages the configuration settings for searching and discovering files and directories while filtering out unwanted entries based on configured patterns. It provides functionality to define which directories should be pruned and which files should be skipped during file system operations.

Direct Known Subclasses

Discover, Search, StripSpaces

Instance Method Summary collapse

Methods inherited from BlockConfig

config, inherited, #initialize, #to_ruby

Constructor Details

This class inherits a constructor from Utils::ConfigFile::BlockConfig

Instance Method Details

#prune?(basename) ⇒ TrueClass, FalseClass

The prune? method checks if a basename matches any of the configured prune directories.

This method determines whether a given filename or directory name should be excluded based on the prune directories configuration. It iterates through the list of prune patterns and returns true if any pattern matches the provided basename.

Parameters:

  • basename (String, Object)

    the basename to check against prune patterns

Returns:

  • (TrueClass, FalseClass)

    true if the basename matches any prune pattern, false otherwise



268
269
270
# File 'lib/utils/config_file.rb', line 268

def prune?(basename)
  Array(prune_dirs).any? { |pd| pd.match(basename.to_s) }
end

#skip?(basename) ⇒ TrueClass, FalseClass

The skip? method determines whether a file should be skipped based on configured patterns.

This method checks if the provided basename matches any of the configured skip patterns. It converts the basename to a string and tests it against all defined skip files.

pattern, false otherwise

Parameters:

  • basename (Object)

    the file or directory name to check

Returns:

  • (TrueClass, FalseClass)

    true if the basename matches any skip



283
284
285
# File 'lib/utils/config_file.rb', line 283

def skip?(basename)
  Array(skip_files).any? { |sf| sf.match(basename.to_s) }
end