Class: Quonfig::Evaluation
- Inherits:
-
Object
- Object
- Quonfig::Evaluation
- Defined in:
- lib/quonfig/evaluation.rb
Overview
Records the result of evaluating a config’s criteria and forensics for reporting
Instance Attribute Summary collapse
-
#context ⇒ Object
readonly
Returns the value of attribute context.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
-
#initialize(config:, value:, value_index:, config_row_index:, context:, resolver:, conditional_value: nil) ⇒ Evaluation
constructor
A new instance of Evaluation.
- #reason ⇒ Object
- #report_and_return(evaluation_summary_aggregator) ⇒ Object
- #reportable_value ⇒ Object
- #unwrapped_value ⇒ Object
Constructor Details
#initialize(config:, value:, value_index:, config_row_index:, context:, resolver:, conditional_value: nil) ⇒ Evaluation
Returns a new instance of Evaluation.
8 9 10 11 12 13 14 15 16 |
# File 'lib/quonfig/evaluation.rb', line 8 def initialize(config:, value:, value_index:, config_row_index:, context:, resolver:, conditional_value: nil) @config = config @value = value @value_index = value_index @config_row_index = config_row_index @context = context @resolver = resolver @conditional_value = conditional_value end |
Instance Attribute Details
#context ⇒ Object (readonly)
Returns the value of attribute context.
6 7 8 |
# File 'lib/quonfig/evaluation.rb', line 6 def context @context end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
6 7 8 |
# File 'lib/quonfig/evaluation.rb', line 6 def value @value end |
Instance Method Details
#reason ⇒ Object
18 19 20 21 22 23 24 25 26 |
# File 'lib/quonfig/evaluation.rb', line 18 def reason @reason ||= @conditional_value ? Quonfig::Reason.compute( config: @config, conditional_value: @conditional_value, weighted_value_index: deepest_value.weighted_value_index ) : Quonfig::Reason::UNKNOWN end |
#report_and_return(evaluation_summary_aggregator) ⇒ Object
36 37 38 39 40 |
# File 'lib/quonfig/evaluation.rb', line 36 def report_and_return(evaluation_summary_aggregator) report(evaluation_summary_aggregator) unwrapped_value end |
#reportable_value ⇒ Object
32 33 34 |
# File 'lib/quonfig/evaluation.rb', line 32 def reportable_value deepest_value.reportable_value end |
#unwrapped_value ⇒ Object
28 29 30 |
# File 'lib/quonfig/evaluation.rb', line 28 def unwrapped_value deepest_value.unwrap end |