Sha256: df88880162bcad845a629f76d1631e4d1116310d8d17f44e321d4c98f7bfa0bf

Contents?: true

Size: 716 Bytes

Versions: 4

Compression:

Stored size: 716 Bytes

Contents

# 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

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rbs-3.1.3 lib/rbs/file_finder.rb
rbs-3.1.2 lib/rbs/file_finder.rb
rbs-3.1.1 lib/rbs/file_finder.rb
rbs-3.1.0 lib/rbs/file_finder.rb