class IOWriter

wrapper class

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/file.rb, line 159
def initialize(io)
  @io = io
end

Public Instance Methods

flush() click to toggle source
# File lib/logstash/outputs/file.rb, line 166
def flush
  @io.flush
  if @io.class == Zlib::GzipWriter
    @io.to_io.flush
  end
end
method_missing(method_name, *args, &block) click to toggle source
Calls superclass method
# File lib/logstash/outputs/file.rb, line 172
def method_missing(method_name, *args, &block)
  if @io.respond_to?(method_name)
    @io.send(method_name, *args, &block)
  else
    super
  end
end
write(*args) click to toggle source
# File lib/logstash/outputs/file.rb, line 162
def write(*args)
  @io.write(*args)
  @active = true
end