-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfile_finder.rbs
28 lines (28 loc) · 1.27 KB
/
file_finder.rbs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
module RBS
module FileFinder
# Enumerate RBS files under path
#
# When `path` is a file, it yields the path.
#
# ```rb
# FileFinder.each_file(Pathname("foo.rbs")) {} # => yields `foo.rbs`
# ```
#
# When `path` is a directory, it yields all `.rbs` files under the directory, recursively.
#
# * Skips files under directory starting with `_`, if `skip_hidden` is `true`
# * Yields files under directory starting with `_` even if `skip_hidden` is true, when the `_` directory is given explicitly, and `immediate:` is `true`
#
# ```rb
# FileFinder.each_file(Pathname("sig"), skip_hidden: false) {} # => yields all `.rbs` files under `sig`
# FileFinder.each_file(Pathname("sig"), skip_hidden: true) {} # => yields all `.rbs` files under `sig`, skips `_` directories
#
# FileFinder.each_file(Pathname("_hidden"), skip_hidden: true) {} # => yields all `.rbs` files under `_hidden`, skips other `_` directories
# ```
#
# `immediate` keyword is unused and left for API compatibility.
#
def self?.each_file: (Pathname path, ?immediate: top, skip_hidden: boolish) { (Pathname) -> void } -> void
| (Pathname path, ?immediate: top, skip_hidden: boolish) -> Enumerator[Pathname, void]
end
end