Class: Qualspec::Evaluation

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(criterion:, score:, pass:, reasoning: nil, model: nil, candidate: nil, scenario: nil, error: nil, scenario_winner: nil) ⇒ Evaluation

Returns a new instance of Evaluation.



8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/qualspec/evaluation.rb', line 8

def initialize(criterion:, score:, pass:, reasoning: nil, model: nil, candidate: nil, scenario: nil, error: nil,
               scenario_winner: nil)
  @criterion = criterion
  @score = score
  @pass = pass
  @reasoning = reasoning
  @model = model
  @candidate = candidate
  @scenario = scenario
  @error = error
  @scenario_winner = scenario_winner
end

Instance Attribute Details

#candidateObject (readonly)

Returns the value of attribute candidate.



5
6
7
# File 'lib/qualspec/evaluation.rb', line 5

def candidate
  @candidate
end

#criterionObject (readonly)

Returns the value of attribute criterion.



5
6
7
# File 'lib/qualspec/evaluation.rb', line 5

def criterion
  @criterion
end

#errorObject (readonly)

Returns the value of attribute error.



5
6
7
# File 'lib/qualspec/evaluation.rb', line 5

def error
  @error
end

#modelObject (readonly)

Returns the value of attribute model.



5
6
7
# File 'lib/qualspec/evaluation.rb', line 5

def model
  @model
end

#passObject (readonly)

Returns the value of attribute pass.



5
6
7
# File 'lib/qualspec/evaluation.rb', line 5

def pass
  @pass
end

#reasoningObject (readonly)

Returns the value of attribute reasoning.



5
6
7
# File 'lib/qualspec/evaluation.rb', line 5

def reasoning
  @reasoning
end

#scenarioObject (readonly)

Returns the value of attribute scenario.



5
6
7
# File 'lib/qualspec/evaluation.rb', line 5

def scenario
  @scenario
end

#scenario_winnerObject

Returns the value of attribute scenario_winner.



6
7
8
# File 'lib/qualspec/evaluation.rb', line 6

def scenario_winner
  @scenario_winner
end

#scoreObject (readonly)

Returns the value of attribute score.



5
6
7
# File 'lib/qualspec/evaluation.rb', line 5

def score
  @score
end

Instance Method Details

#error?Boolean

Returns:

  • (Boolean)


29
30
31
# File 'lib/qualspec/evaluation.rb', line 29

def error?
  !@error.nil?
end

#fail?Boolean

Returns:

  • (Boolean)


25
26
27
# File 'lib/qualspec/evaluation.rb', line 25

def fail?
  !pass?
end

#pass?Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/qualspec/evaluation.rb', line 21

def pass?
  @pass == true
end

#score_pctObject

Score as percentage (0-100)



34
35
36
# File 'lib/qualspec/evaluation.rb', line 34

def score_pct
  (@score.to_f / 10 * 100).round
end

#to_hObject



38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/qualspec/evaluation.rb', line 38

def to_h
  {
    criterion: @criterion,
    score: @score,
    pass: @pass,
    reasoning: @reasoning,
    model: @model,
    candidate: @candidate,
    scenario: @scenario,
    error: @error,
    scenario_winner: @scenario_winner
  }.compact
end