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.



363
364
365
# File 'lib/logstash/outputs/file.rb', line 363

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



379
380
381
382
383
384
385
386
# File 'lib/logstash/outputs/file.rb', line 379

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.



361
362
363
# File 'lib/logstash/outputs/file.rb', line 361

def active
  @active
end

Instance Method Details

#flushObject



372
373
374
375
376
377
# File 'lib/logstash/outputs/file.rb', line 372

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

#write(*args) ⇒ Object



367
368
369
370
# File 'lib/logstash/outputs/file.rb', line 367

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