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.



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

Instance Attribute Details

#idObject

Returns the value of attribute id.



99
100
101
# File 'lib/coderunner/merged_code_runner.rb', line 99

def id
  @id
end

#runObject (readonly)

Returns the value of attribute run.



98
99
100
# File 'lib/coderunner/merged_code_runner.rb', line 98

def run
  @run
end