Class: Typesafe::Score
Overview
A question that positions the state along an ordered spectrum of levels. The answer includes the score, the legend (levels by number), the probability distribution across levels, and a confidence.
Typesafe::Score.new("How frustrated is the customer?",
criteria: [
"Calm, just stating facts",
"Frustrated but civil",
"Very angry, strong language"
])
Instance Attribute Summary collapse
-
#criteria ⇒ Array<String>
readonly
The ordered levels of the spectrum.
Attributes inherited from Question
Instance Method Summary collapse
-
#initialize(instructions, criteria:) ⇒ Score
constructor
A new instance of Score.
- #to_h ⇒ Object
- #type ⇒ Object
Methods inherited from Question
Constructor Details
#initialize(instructions, criteria:) ⇒ Score
Returns a new instance of Score.
21 22 23 24 |
# File 'lib/typesafe/score.rb', line 21 def initialize(instructions, criteria:) @criteria = normalize_criteria(criteria) super(instructions) end |
Instance Attribute Details
#criteria ⇒ Array<String> (readonly)
Returns the ordered levels of the spectrum.
16 17 18 |
# File 'lib/typesafe/score.rb', line 16 def criteria @criteria end |
Instance Method Details
#to_h ⇒ Object
30 31 32 |
# File 'lib/typesafe/score.rb', line 30 def to_h super.merge(criteria: @criteria) end |
#type ⇒ Object
26 27 28 |
# File 'lib/typesafe/score.rb', line 26 def type "score" end |