Module: Tins::Find
- Defined in:
- lib/tins/find.rb
Overview
This module provides file system traversal functionality with support for filtering by file type, handling of hidden files, and error management.
The Find module implements a depth-first search algorithm that traverses directory trees, yielding each path to the provided block. It handles various edge cases including symbolic links, permission errors, and circular references.
Defined Under Namespace
Classes: Finder
Constant Summary collapse
- EXPECTED_STANDARD_ERRORS =
Standard errors that are expected during file system operations and will be silently handled unless raise_errors is enabled
ModuleGroup[ Errno::ENOENT, Errno::EACCES, Errno::ENOTDIR, Errno::ELOOP, Errno::ENAMETOOLONG ]
Class Method Summary collapse
-
.find(*paths, **opts) {|String| ... } ⇒ Enumerator
Performs a depth-first search of the specified paths, yielding each matching path to the block.
-
.prune ⇒ Object
Skips the current path or directory, restarting the loop with the next entry.
Instance Method Summary collapse
-
#find(*paths, **opts) {|String| ... } ⇒ Enumerator
private
Performs a depth-first search of the specified paths, yielding each matching path to the block.
-
#prune ⇒ Object
private
Skips the current path or directory, restarting the loop with the next entry.
Class Method Details
.find(*paths, **opts) {|String| ... } ⇒ Enumerator
Performs a depth-first search of the specified paths, yielding each matching path to the block
231 232 233 |
# File 'lib/tins/find.rb', line 231 def find(*paths, **opts, &block) Finder.new(opts).find(*paths, &block) end |
.prune ⇒ Object
Skips the current path or directory, restarting the loop with the next entry. Meaningful only within the block associated with Find.find.
246 247 248 |
# File 'lib/tins/find.rb', line 246 def prune throw :prune end |
Instance Method Details
#find(*paths, **opts) {|String| ... } ⇒ Enumerator (private)
Performs a depth-first search of the specified paths, yielding each matching path to the block
231 232 233 |
# File 'lib/tins/find.rb', line 231 def find(*paths, **opts, &block) Finder.new(opts).find(*paths, &block) end |
#prune ⇒ Object (private)
Skips the current path or directory, restarting the loop with the next entry. Meaningful only within the block associated with Find.find.
246 247 248 |
# File 'lib/tins/find.rb', line 246 def prune throw :prune end |