Sha256: d22dfcc21c8bb2211919c37c2d7920cd4bf1fd9dee7977ff687f96a4af673f48

Contents?: true

Size: 601 Bytes

Versions: 1

Compression:

Stored size: 601 Bytes

Contents

require_relative "../file"
require_relative "../processor"

class Metacrunch::File::Writer < Metacrunch::Processor
  require_relative "./writer/plain_file_writer"
  require_relative "./writer/tar_file_writer"
  require_relative "./writer/zip_file_writer"

  def initialize(filename)
    @writer =
    [TarFileWriter, ZipFileWriter, PlainFileWriter].find do |_writer|
      _writer.supports?(filename)
    end
    .try do |_appropriate_writer_class|
      _appropriate_writer_class.new(filename)
    end
  end

  def close
    @writer.close
  end

  def write(*args)
    @writer.write(*args)
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
metacrunch-2.2.3 lib/metacrunch/file/writer.rb