Class: CodeRunner::Run::Merged

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

Constructor Details

#initialize(runner_index, run) ⇒ Merged

Returns a new instance of Merged.



95
96
97
98
99
# File 'lib/coderunner/merged_code_runner.rb', line 95

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



103
104
105
# File 'lib/coderunner/merged_code_runner.rb', line 103

def method_missing(meth, *args)
  @run.send(meth, *args)
end

Instance Attribute Details

#idObject

Returns the value of attribute id.



94
95
96
# File 'lib/coderunner/merged_code_runner.rb', line 94

def id
  @id
end

#runObject (readonly)

Returns the value of attribute run.



93
94
95
# File 'lib/coderunner/merged_code_runner.rb', line 93

def run
  @run
end