Class: Mediakit::Process::Runner::IOWatcher
- Inherits:
-
Coolio::IO
- Object
- Coolio::IO
- Mediakit::Process::Runner::IOWatcher
- Defined in:
- lib/mediakit/process/runner.rb
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Returns the value of attribute data.
-
#io ⇒ Object
readonly
Returns the value of attribute io.
Instance Method Summary collapse
-
#initialize(io, &block) ⇒ IOWatcher
constructor
A new instance of IOWatcher.
- #on_close ⇒ Object
- #on_read(data) ⇒ Object
- #read ⇒ Object
Constructor Details
#initialize(io, &block) ⇒ IOWatcher
Returns a new instance of IOWatcher.
115 116 117 118 119 120 |
# File 'lib/mediakit/process/runner.rb', line 115 def initialize(io, &block) @io = io @block = block @data = '' super end |
Instance Attribute Details
#data ⇒ Object (readonly)
Returns the value of attribute data.
113 114 115 |
# File 'lib/mediakit/process/runner.rb', line 113 def data @data end |
#io ⇒ Object (readonly)
Returns the value of attribute io.
113 114 115 |
# File 'lib/mediakit/process/runner.rb', line 113 def io @io end |
Instance Method Details
#on_close ⇒ Object
127 128 129 |
# File 'lib/mediakit/process/runner.rb', line 127 def on_close @block = nil end |
#on_read(data) ⇒ Object
122 123 124 125 |
# File 'lib/mediakit/process/runner.rb', line 122 def on_read(data) @block.call(data) @data << data end |
#read ⇒ Object
131 132 133 134 |
# File 'lib/mediakit/process/runner.rb', line 131 def read @data << @io.read unless @io.closed? @io.close unless @io.closed? end |