Class: PipeWrapper

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

Overview

class LogStash::Outputs::Pipe

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(command, mode = "a+") ⇒ PipeWrapper

Returns a new instance of PipeWrapper.



109
110
111
112
# File 'lib/logstash/outputs/pipe.rb', line 109

def initialize(command, mode="a+")
  @pipe = IO.popen(command, mode)
  @active = false
end

Instance Attribute Details

#activeObject

Returns the value of attribute active.



108
109
110
# File 'lib/logstash/outputs/pipe.rb', line 108

def active
  @active
end

Instance Method Details

#method_missing?(m, *args) ⇒ Boolean

Returns:

  • (Boolean)


114
115
116
117
118
119
120
# File 'lib/logstash/outputs/pipe.rb', line 114

def method_missing?(m, *args)
  if @pipe.respond_to? m
    @pipe.send(m, *args)
  else
    raise NoMethodError
  end
end

#puts(txt) ⇒ Object



122
123
124
125
126
# File 'lib/logstash/outputs/pipe.rb', line 122

def puts(txt)
  @pipe.puts(txt)
  @pipe.flush
  @active = true
end

#write(txt) ⇒ Object



128
129
130
131
# File 'lib/logstash/outputs/pipe.rb', line 128

def write(txt)
  @pipe.write(txt)
  @active = true
end