-
-
Save havenwood/1a81eef6932aa8e0e02064208722a01a to your computer and use it in GitHub Desktop.
Example of Find.find for CableNinja on IRC
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
require 'find' | |
class Dir | |
def self.entries_r(dirname) | |
entries = [] | |
Find.find dirname do |path| | |
if File.directory?(path) | |
# Do not traverse dotfile directories. | |
Find.prune if File.basename(File.expand_path(path)).start_with?('.') | |
next | |
else | |
entries << path | |
end | |
end | |
entries | |
end | |
end | |
Dir.entries_r '.' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment