-
Notifications
You must be signed in to change notification settings - Fork 217
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1287 from pocke/subtract
Implement `rbs subtract` command
- Loading branch information
Showing
12 changed files
with
1,103 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# frozen_string_literal: true | ||
|
||
module RBS | ||
module FileFinder | ||
module_function | ||
|
||
def self.each_file(path, immediate:, skip_hidden:, &block) | ||
return enum_for(__method__, path, immediate: immediate, skip_hidden: skip_hidden) unless block | ||
|
||
case | ||
when path.file? | ||
if path.extname == ".rbs" || immediate | ||
yield path | ||
end | ||
|
||
when path.directory? | ||
if path.basename.to_s.start_with?("_") | ||
if skip_hidden | ||
unless immediate | ||
return | ||
end | ||
end | ||
end | ||
|
||
path.children.sort.each do |child| | ||
each_file(child, immediate: false, skip_hidden: skip_hidden, &block) | ||
end | ||
end | ||
end | ||
end | ||
end |
Oops, something went wrong.