Parent

Methods

Class Index [+]

Quicksearch

Gem::Package::TarWriter::BoundedStream

IO wrapper that allows writing a limited amount of data

Attributes

limit[R]

Maximum number of bytes that can be written

written[R]

Number of bytes written

Public Class Methods

new(io, limit) click to toggle source

Wraps io and allows up to limit bytes to be written

    # File lib/rubygems/package/tar_writer.rb, line 32
32:     def initialize(io, limit)
33:       @io = io
34:       @limit = limit
35:       @written = 0
36:     end

Public Instance Methods

write(data) click to toggle source

Writes data onto the IO, raising a FileOverflow exception if the number of bytes will be more than #

    # File lib/rubygems/package/tar_writer.rb, line 42
42:     def write(data)
43:       if data.size + @written > @limit
44:         raise FileOverflow, "You tried to feed more data than fits in the file."
45:       end
46:       @io.write data
47:       @written += data.size
48:       data.size
49:     end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.