Class: Gotta::Run::DynamicRunner
- Inherits:
-
Object
- Object
- Gotta::Run::DynamicRunner
- Defined in:
- lib/gotta/run.rb,
lib/gotta/run/dynamic_runner.rb
Overview
This class is responsible for all dynamic runners. It was designed to be used as a inheritable class. For example: ‘class RubyRunner < Gotta::Run::DynamicRunner; end`
Instance Attribute Summary collapse
-
#input_queue ⇒ Object
readonly
Returns the value of attribute input_queue.
Instance Method Summary collapse
-
#initialize(input_queue: Gotta::Queue.new('input'), runtime_path: nil, &block) ⇒ DynamicRunner
constructor
The initializer takes an input queue, where it should go fetch payloads to send to runners.
- #start ⇒ Object
Constructor Details
#initialize(input_queue: Gotta::Queue.new('input'), runtime_path: nil, &block) ⇒ DynamicRunner
The initializer takes an input queue, where it should go fetch payloads to send to runners. The default queue is ‘Gotta::Queue::Memory::Driver`. It also takes an optional argument `runtime_path` that is the path to the runtime script for the language you want to run. You can optionally pass a block in case you need to set extra configuration without having to override the initializer. It will raise `RuntimeScriptNotFound` if `runtime_path` doesn’t exist or is not a file.
46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/gotta/run.rb', line 46 def initialize(input_queue: Gotta::Queue.new('input'), runtime_path: nil, &block) @input_queue = input_queue @runtime_path = runtime_path raise RuntimeScriptNotFound, path unless File.file?(runtime_path) @parent_socket, @child_socket = UNIXSocket.pair @child_output_r, @child_output_w = IO.pair instance_eval(&block) if block_given? end |
Instance Attribute Details
#input_queue ⇒ Object (readonly)
Returns the value of attribute input_queue.
33 34 35 |
# File 'lib/gotta/run.rb', line 33 def input_queue @input_queue end |
Instance Method Details
#start ⇒ Object
58 59 60 61 62 |
# File 'lib/gotta/run.rb', line 58 def start start_runtime @child_stdout_thread = connect_to_child_stdout start_processing end |