class ZipTricks::WriteAndTell
A tiny wrapper over any object that supports :<<. Adds :tell and :advance_position_by.
Public Class Methods
new(io)
click to toggle source
# File lib/zip_tricks/write_and_tell.rb, line 6 def initialize(io) @io = io @pos = 0 end
Public Instance Methods
<<(bytes)
click to toggle source
# File lib/zip_tricks/write_and_tell.rb, line 11 def <<(bytes) return self if bytes.nil? @io << bytes.b @pos += bytes.bytesize self end
advance_position_by(num_bytes)
click to toggle source
# File lib/zip_tricks/write_and_tell.rb, line 18 def advance_position_by(num_bytes) @pos += num_bytes end
tell()
click to toggle source
# File lib/zip_tricks/write_and_tell.rb, line 22 def tell @pos end