Class: IOWriter

Inherits:
Object
  • Object
show all
Defined in:
lib/logstash/outputs/file.rb

Overview

wrapper class

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(io) ⇒ IOWriter

Returns a new instance of IOWriter.



228
229
230
# File 'lib/logstash/outputs/file.rb', line 228

def initialize(io)
  @io = io
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method_name, *args, &block) ⇒ Object



241
242
243
244
245
246
247
# File 'lib/logstash/outputs/file.rb', line 241

def method_missing(method_name, *args, &block)
  if @io.respond_to?(method_name)
    @io.send(method_name, *args, &block)
  else
    super
  end
end

Instance Attribute Details

#activeObject

Returns the value of attribute active.



248
249
250
# File 'lib/logstash/outputs/file.rb', line 248

def active
  @active
end

Instance Method Details

#flushObject



235
236
237
238
239
240
# File 'lib/logstash/outputs/file.rb', line 235

def flush
  @io.flush
  if @io.class == Zlib::GzipWriter
    @io.to_io.flush
  end
end

#write(*args) ⇒ Object



231
232
233
234
# File 'lib/logstash/outputs/file.rb', line 231

def write(*args)
  @io.write(*args)
  @active = true
end