Class: CodeRunner::Run::Merged
- Defined in:
- lib/coderunner/merged_code_runner.rb
Overview
This is a container for run objects for use in a merged runner. Basically its job is to route all methods to the run it contains, except for the id method, which is redefined.
Instead of being a number, the id of the run is now an array of two numbers, of which the second is the id of the run contained, but the first is the index of the runner which the run corresponds to.
Thus, within a merged runner (an instance of CodeRunner::Merged), each run has a unique id, and the merged runner can treat the Run::Merged objects exactly as if they were simply Run objects.
Instance Attribute Summary collapse
-
#id ⇒ Object
Returns the value of attribute id.
-
#run ⇒ Object
readonly
Returns the value of attribute run.
Instance Method Summary collapse
-
#initialize(runner_index, run) ⇒ Merged
constructor
A new instance of Merged.
-
#method_missing(meth, *args) ⇒ Object
end.
Constructor Details
#initialize(runner_index, run) ⇒ Merged
Returns a new instance of Merged.
100 101 102 103 104 |
# File 'lib/coderunner/merged_code_runner.rb', line 100 def initialize(runner_index, run) @runner_index = runner_index @run = run @id = [@runner_index, @run.id] end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(meth, *args) ⇒ Object
end
108 109 110 |
# File 'lib/coderunner/merged_code_runner.rb', line 108 def method_missing(meth, *args) @run.send(meth, *args) end |