Module: ZipTricks::NullWriter

Defined in:
lib/zip_tricks/null_writer.rb

Overview

Used when you need to supply a destination IO for some write operations, but want to discard the data (like when estimating the size of a ZIP)

Class Method Summary collapse

Class Method Details

.<<(data) ⇒ self

Parameters:

  • data (String)

    the data to write

Returns:

  • (self)


7
# File 'lib/zip_tricks/null_writer.rb', line 7

def self.<<(data); self; end

.write(data) ⇒ Fixnum

Returns the amount of data that was supposed to be written.

Parameters:

  • data (String)

    the data to write

Returns:

  • (Fixnum)

    the amount of data that was supposed to be written



11
# File 'lib/zip_tricks/null_writer.rb', line 11

def self.write(data); data.bytesize; end