Class: PipeWrapper
- Inherits:
-
Object
- Object
- PipeWrapper
- Defined in:
- lib/logstash/outputs/pipe.rb
Overview
class LogStash::Outputs::Pipe
Instance Attribute Summary collapse
-
#active ⇒ Object
Returns the value of attribute active.
Instance Method Summary collapse
-
#initialize(command, mode = "a+") ⇒ PipeWrapper
constructor
A new instance of PipeWrapper.
- #method_missing(m, *args) ⇒ Object
- #puts(txt) ⇒ Object
- #write(txt) ⇒ Object
Constructor Details
#initialize(command, mode = "a+") ⇒ PipeWrapper
Returns a new instance of PipeWrapper.
108 109 110 111 |
# File 'lib/logstash/outputs/pipe.rb', line 108 def initialize(command, mode="a+") @pipe = IO.popen(command, mode) @active = false end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(m, *args) ⇒ Object
113 114 115 116 117 118 119 |
# File 'lib/logstash/outputs/pipe.rb', line 113 def method_missing(m, *args) if @pipe.respond_to? m @pipe.send(m, *args) else raise NoMethodError end end |
Instance Attribute Details
#active ⇒ Object
Returns the value of attribute active.
107 108 109 |
# File 'lib/logstash/outputs/pipe.rb', line 107 def active @active end |
Instance Method Details
#puts(txt) ⇒ Object
121 122 123 124 125 |
# File 'lib/logstash/outputs/pipe.rb', line 121 def puts(txt) @pipe.puts(txt) @pipe.flush @active = true end |
#write(txt) ⇒ Object
127 128 129 130 |
# File 'lib/logstash/outputs/pipe.rb', line 127 def write(txt) @pipe.write(txt) @active = true end |