Sha256: e3e9d339052a809841a6351ca753aab51febe03f2ec7b5857a1150ab05e8ecf2

Contents?: true

Size: 392 Bytes

Versions: 3

Compression:

Stored size: 392 Bytes

Contents

module FileScanner
  class Loader
    def initialize(path:, extensions: [])
      @path = path
      @extensions = extensions
    end

    def call
      Dir.glob(files_path)
    end

    private def files_path
      File.join(@path, "**", extensions_path)
    end

    private def extensions_path
      return "*" if @extensions.empty?
      "*.{#{@extensions.join(",")}}"
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
file_scanner-1.0.5 lib/file_scanner/loader.rb
file_scanner-1.0.4 lib/file_scanner/loader.rb
file_scanner-1.0.3 lib/file_scanner/loader.rb