Class: MiniTarball::PlaceholderStream
- Inherits:
-
LimitedSizeStream
- Object
- LimitedSizeStream
- MiniTarball::PlaceholderStream
- Defined in:
- lib/mini_tarball/streams/placeholder_stream.rb
Instance Attribute Summary
Attributes inherited from LimitedSizeStream
#end_position, #start_position
Instance Method Summary collapse
-
#initialize(io, start_position:, file_size:) ⇒ PlaceholderStream
constructor
A new instance of PlaceholderStream.
- #write(data) ⇒ Object
Constructor Details
#initialize(io, start_position:, file_size:) ⇒ PlaceholderStream
Returns a new instance of PlaceholderStream.
5 6 7 |
# File 'lib/mini_tarball/streams/placeholder_stream.rb', line 5 def initialize(io, start_position:, file_size:) super(io, start_position: start_position, max_file_size: file_size) end |
Instance Method Details
#write(data) ⇒ Object
9 10 11 12 13 14 15 |
# File 'lib/mini_tarball/streams/placeholder_stream.rb', line 9 def write(data) super(data) if (current_position = io.pos) <= end_position io.write("\0" * (end_position - current_position)) end end |