Class: Diogenes::Evaluation::Session

Inherits:
Object
  • Object
show all
Defined in:
lib/diogenes/evaluation/session.rb

Defined Under Namespace

Classes: Result

Constant Summary collapse

SEPARATOR =

: String

("" * 60).freeze

Instance Method Summary collapse

Constructor Details

#initialize(description:, out:, err:, **opts) ⇒ Session

: (description: String, out: IO, err: IO, **untyped) -> void



15
16
17
18
19
20
21
22
# File 'lib/diogenes/evaluation/session.rb', line 15

def initialize(description:, out:, err:, **opts)
  @description = description
  @out = out
  @err = err
  @in = opts.fetch(:in, $stdin)
  @cwd = opts.fetch(:cwd, Dir.pwd) #: String
  @results = [] #: Array[untyped]
end

Instance Method Details

#runObject

: () -> Integer



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/diogenes/evaluation/session.rb', line 25

def run
  print_header

  Gates::ALL.each_with_index do |gate, index|
    run_gate(gate, index + 1)

    if @results.last.failed? && !prompt_continue?
      print_partial_summary
      return 1
    end
  end

  print_final_summary
  prompt_decision_record

  @results.all?(&:passed?) ? 0 : 1
rescue Interrupt
  @out.puts "\n\nEvaluation interrupted."
  print_partial_summary
  1
end