123456789_123456789_123456789_123456789_123456789_

Module: RBS::FileFinder

Relationships & Source Files
Extension / Inclusion / Inheritance Descendants
Included In:
Defined in: lib/rbs/file_finder.rb

Class Method Summary

Class Method Details

.each_file(path, immediate:, skip_hidden:, &block)

[ GitHub ]

  
# File 'lib/rbs/file_finder.rb', line 7

def self.each_file(path, immediate:, skip_hidden:, &block)
  return enum_for((__method__ or raise), 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