Module: ShatteredSupport::CoreExtensions::Dir::Search::ClassMethods
- Defined in:
- lib/shattered_support/core_ext/dir/search.rb
Overview
Dir.each_in_path will recursively yield all non-hidden directories from the given path.
Instance Method Summary collapse
Instance Method Details
#each_in_path(path) {|path| ... } ⇒ Object
13 14 15 16 17 18 19 20 |
# File 'lib/shattered_support/core_ext/dir/search.rb', line 13 def each_in_path(path, &block) raise Errno::ENOENT.new("Path not found: '#{path}'") unless ::File.directory? path yield path foreach(path) do |directory| next if directory =~ /\..*/ each_in_path("#{path}/#{directory}", &block) if ::File.directory?("#{path}/#{directory}") end end |