Sha256: 4f23e6dec0f56b2e9cbc090a98dad275418e294bf0165b0fe92b93ea9601a1bc

Contents?: true

Size: 410 Bytes

Versions: 7

Compression:

Stored size: 410 Bytes

Contents

module FileScanner
  class Loader
    def initialize(path:, extensions: [])
      @path = File.expand_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

7 entries across 7 versions & 1 rubygems

Version Path
file_scanner-2.1.1 lib/file_scanner/loader.rb
file_scanner-2.1.0 lib/file_scanner/loader.rb
file_scanner-2.0.4 lib/file_scanner/loader.rb
file_scanner-2.0.3 lib/file_scanner/loader.rb
file_scanner-2.0.2 lib/file_scanner/loader.rb
file_scanner-2.0.1 lib/file_scanner/loader.rb
file_scanner-1.1.0 lib/file_scanner/loader.rb