Class: Gobstones::Batch
- Inherits:
-
Object
- Object
- Gobstones::Batch
- Defined in:
- lib/gobstones/batch.rb
Instance Attribute Summary collapse
-
#content ⇒ Object
Returns the value of attribute content.
-
#examples ⇒ Object
Returns the value of attribute examples.
-
#extra ⇒ Object
Returns the value of attribute extra.
-
#options ⇒ Object
Returns the value of attribute options.
Instance Method Summary collapse
-
#initialize(content, examples, extra, options) ⇒ Batch
constructor
A new instance of Batch.
- #run_tests!(output) ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(content, examples, extra, options) ⇒ Batch
Returns a new instance of Batch.
5 6 7 8 9 10 11 |
# File 'lib/gobstones/batch.rb', line 5 def initialize(content, examples, extra, ) @content = content @examples = examples @extra = extra @options = @compilation_mode = @options[:game_framework] ? Gobstones::CompilationMode::GameFramework : Gobstones::CompilationMode::Classic end |
Instance Attribute Details
#content ⇒ Object
Returns the value of attribute content.
2 3 4 |
# File 'lib/gobstones/batch.rb', line 2 def content @content end |
#examples ⇒ Object
Returns the value of attribute examples.
2 3 4 |
# File 'lib/gobstones/batch.rb', line 2 def examples @examples end |
#extra ⇒ Object
Returns the value of attribute extra.
2 3 4 |
# File 'lib/gobstones/batch.rb', line 2 def extra @extra end |
#options ⇒ Object
Returns the value of attribute options.
2 3 4 |
# File 'lib/gobstones/batch.rb', line 2 def @options end |
Instance Method Details
#run_tests!(output) ⇒ Object
13 14 15 16 17 |
# File 'lib/gobstones/batch.rb', line 13 def run_tests!(output) Mumukit::Metatest::Framework.new( checker: Gobstones::Checker.new(), runner: Gobstones::MultipleExecutionsRunner.new).test output, examples end |
#to_json ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/gobstones/batch.rb', line 19 def to_json { code: compile_content(content), extraCode: compile_extra(extra), examples: examples.map { |example| example_json(example) } }.to_json end |