class GCSIOWriter

Wrapper class that abstracts which IO being used (for instance, regular files or GzipWriter.

Inspired by lib/logstash/outputs/file.rb.

Attributes

active[RW]

Public Class Methods

new(io) click to toggle source
# File lib/logstash/outputs/google_cloud_storage.rb, line 405
def initialize(io)
  @io = io
end

Public Instance Methods

fsync() click to toggle source
# File lib/logstash/outputs/google_cloud_storage.rb, line 411
def fsync
  if @io.class == Zlib::GzipWriter
    @io.flush
    @io.to_io.fsync
  else
    @io.fsync
  end
end
method_missing(method_name, *args, &block) click to toggle source
Calls superclass method
# File lib/logstash/outputs/google_cloud_storage.rb, line 419
def method_missing(method_name, *args, &block)
  if @io.respond_to?(method_name)
    @io.send(method_name, *args, &block)
  else
    if @io.class == Zlib::GzipWriter && @io.to_io.respond_to?(method_name)
      @io.to_io.send(method_name, *args, &block)
    else
      super
    end
  end
end
write(*args) click to toggle source
# File lib/logstash/outputs/google_cloud_storage.rb, line 408
def write(*args)
  @io.write(*args)
end