Class: Bbq::Spawn::CoordinatedExecutor
- Inherits:
-
Object
- Object
- Bbq::Spawn::CoordinatedExecutor
- Extended by:
- Forwardable
- Defined in:
- lib/bbq/spawn.rb
Instance Method Summary collapse
-
#initialize(executor, options = {}) ⇒ CoordinatedExecutor
constructor
A new instance of CoordinatedExecutor.
- #join ⇒ Object
- #start ⇒ Object
Constructor Details
#initialize(executor, options = {}) ⇒ CoordinatedExecutor
Returns a new instance of CoordinatedExecutor.
32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/bbq/spawn.rb', line 32 def initialize(executor, = {}) @executor = executor @timeout = .fetch(:timeout, 10) @banner = [:banner] @host = [:host] @port = [:port] @url = [:url] @reader, @writer = IO.pipe @strategy = [:strategy] || IOStrategy::Squelch.new(@writer) end |
Instance Method Details
#join ⇒ Object
51 52 53 54 55 56 57 |
# File 'lib/bbq/spawn.rb', line 51 def join Timeout.timeout(@timeout) do wait_for_io if @banner wait_for_socket if @port and @host wait_for_response if @url end end |
#start ⇒ Object
45 46 47 48 49 |
# File 'lib/bbq/spawn.rb', line 45 def start @strategy.run(@executor.io) @executor.start @strategy.after_run if @strategy.respond_to? :after_run end |