module Zip::IOExtras::AbstractOutputStream

Implements many of the output convenience methods of IO. relies on <<

Public Instance Methods

print(*params) click to toggle source
printf(a_format_string, *params) click to toggle source
# File lib/zip/ioextras/abstract_output_stream.rb, line 17
def printf(a_format_string, *params)
  self << sprintf(a_format_string, *params)
end
putc(an_object) click to toggle source
# File lib/zip/ioextras/abstract_output_stream.rb, line 21
def putc(an_object)
  self << case an_object
          when Fixnum
            an_object.chr
          when String
            an_object
          else
            raise TypeError, 'putc: Only Fixnum and String supported'
          end
  an_object
end
puts(*params) click to toggle source
# File lib/zip/ioextras/abstract_output_stream.rb, line 33
def puts(*params)
  params << "\n" if params.empty?
  params.flatten.each do |element|
    val = element.to_s
    self << val
    self << "\n" unless val[-1, 1] == "\n"
  end
end
write(data) click to toggle source
# File lib/zip/ioextras/abstract_output_stream.rb, line 8
def write(data)
  self << data
  data.to_s.bytesize
end