Class: R10K::Util::Subprocess::Runner::Pump Private
- Inherits:
-
Object
- Object
- R10K::Util::Subprocess::Runner::Pump
- Defined in:
- lib/r10k/util/subprocess/runner/pump.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Perform nonblocking reads on a streaming IO instance.
Instance Attribute Summary collapse
-
#max_delay ⇒ Float
The maximum time to wait while polling the IO device.
-
#min_delay ⇒ Float
The minimum time to wait while polling the IO device.
-
#string ⇒ Object
readonly
private
!@attribute [r] string @return [String] The output collected from the IO device.
Instance Method Summary collapse
- #halt! ⇒ Object private
-
#initialize(io) ⇒ Pump
constructor
private
A new instance of Pump.
- #start ⇒ Object private
-
#wait ⇒ Object
private
Block until the pumping thread reaches EOF on the IO object.
Constructor Details
#initialize(io) ⇒ Pump
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Pump.
20 21 22 23 24 25 26 27 |
# File 'lib/r10k/util/subprocess/runner/pump.rb', line 20 def initialize(io) @io = io @thread = nil @string = '' @run = true @min_delay = 0.05 @max_delay = 1.0 end |
Instance Attribute Details
#max_delay ⇒ Float
Returns The maximum time to wait while polling the IO device.
18 19 20 |
# File 'lib/r10k/util/subprocess/runner/pump.rb', line 18 def max_delay @max_delay end |
#min_delay ⇒ Float
Returns The minimum time to wait while polling the IO device.
14 15 16 |
# File 'lib/r10k/util/subprocess/runner/pump.rb', line 14 def min_delay @min_delay end |
#string ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
!@attribute [r] string
@return [String] The output collected from the IO device
10 11 12 |
# File 'lib/r10k/util/subprocess/runner/pump.rb', line 10 def string @string end |
Instance Method Details
#halt! ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
33 34 35 36 |
# File 'lib/r10k/util/subprocess/runner/pump.rb', line 33 def halt! @run = false @thread.join end |
#start ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
29 30 31 |
# File 'lib/r10k/util/subprocess/runner/pump.rb', line 29 def start @thread = Thread.new { pump } end |
#wait ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Block until the pumping thread reaches EOF on the IO object.
39 40 41 |
# File 'lib/r10k/util/subprocess/runner/pump.rb', line 39 def wait @thread.join end |