Class: Gobstones::Batch

Inherits:
Object
  • Object
show all
Defined in:
lib/gobstones/batch.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(content, examples, extra, options) ⇒ Batch

Returns a new instance of Batch.



4
5
6
7
8
9
# File 'lib/gobstones/batch.rb', line 4

def initialize(content, examples, extra, options)
  @content = content
  @examples = examples
  @extra = extra
  @options = options
end

Instance Attribute Details

#contentObject

Returns the value of attribute content.



2
3
4
# File 'lib/gobstones/batch.rb', line 2

def content
  @content
end

#examplesObject

Returns the value of attribute examples.



2
3
4
# File 'lib/gobstones/batch.rb', line 2

def examples
  @examples
end

#extraObject

Returns the value of attribute extra.



2
3
4
# File 'lib/gobstones/batch.rb', line 2

def extra
  @extra
end

#optionsObject

Returns the value of attribute options.



2
3
4
# File 'lib/gobstones/batch.rb', line 2

def options
  @options
end

Instance Method Details

#run_tests!(output) ⇒ Object



11
12
13
14
15
# File 'lib/gobstones/batch.rb', line 11

def run_tests!(output)
  Mumukit::Metatest::Framework.new(
    checker: Gobstones::Checker.new(options),
    runner: Gobstones::MultipleExecutionsRunner.new).test output, examples
end

#to_jsonObject



17
18
19
20
21
22
23
# File 'lib/gobstones/batch.rb', line 17

def to_json
  {
    code: content,
    extraCode: extra,
    examples: examples.map { |example| example_json(example) }
  }.to_json
end