Class: Mxrb::Runtime::Native::Executor
- Inherits:
-
Object
- Object
- Mxrb::Runtime::Native::Executor
- Defined in:
- lib/mxrb/runtime/native.rb
Overview
Runs existing functional definitions against the Ruby interpreter.
Instance Method Summary collapse
-
#initialize(project_path, definition, output: nil, clock: Process.method(:clock_gettime)) ⇒ Executor
constructor
A new instance of Executor.
- #run ⇒ Object
Constructor Details
#initialize(project_path, definition, output: nil, clock: Process.method(:clock_gettime)) ⇒ Executor
Returns a new instance of Executor.
410 411 412 413 414 415 |
# File 'lib/mxrb/runtime/native.rb', line 410 def initialize(project_path, definition, output: nil, clock: Process.method(:clock_gettime), **) @project_path = File.(project_path) @definition = definition @output = output @clock = clock end |
Instance Method Details
#run ⇒ Object
417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 |
# File 'lib/mxrb/runtime/native.rb', line 417 def run started = monotonic_time project = Model::Project.open(@project_path) interpreter = Interpreter.new(project) tests = @definition.tests.map { run_test(interpreter, _1) } transcript = tests.map { "[MXRB_TEST] #{_1.passed? ? 'PASS' : 'FAIL'} #{_1.name}" }.join("\n") transcript = "#{transcript}\n[MXRB_TEST] DONE\n" @output&.write(transcript) Execution.new( Functional::Result.new(tests.freeze, true), 'MXRB native validation passed', 'Ruby microflow interpreter', transcript, monotonic_time - started ) ensure project&.close end |