lib/dat/science/experiment.rb in dat-science-1.2.0 vs lib/dat/science/experiment.rb in dat-science-1.2.1
- old
+ new
@@ -99,15 +99,26 @@
:candidate => candidate.payload,
:control => control.payload,
:first => control_runs_first? ? :control : :candidate
}
- kind = control == candidate ? :match : :mismatch
+ kind = evaluate control, candidate
publish_with_context kind, payload
raise control.exception if control.raised?
control.value
+ end
+
+ # Public: Determine the outcome of an experiment run
+ #
+ # control - result from running control method
+ # candidate - result from running candidate method
+ #
+ # Returns :match if control and candidate produced the same
+ # result, :mismatch otherwise.
+ def evaluate(control, candidate)
+ control == candidate ? :match : :mismatch
end
protected
# Internal: Does this experiment have candidate behavior?