lib/dat/science/experiment.rb
# Public: Run the control and candidate behaviors, timing each and
# comparing the results. The run order is randomized. Returns the control
# behavior's result.
#
# If the experiment is disabled or candidate behavior isn't provided the
# control behavior's result will be returned immediately.
Run the control and candidate behaviors, timing each and
comparing the results. The run order is randomized. Returns the control
behavior's result.

If the experiment is disabled or candidate behavior isn't provided the
control behavior's result will be returned immediately.
Run the control and candidate behaviors timing each and comparing the results . The run order is randomized . Returns the control behavior ' s result . If the experiment is disabled or candidate behavior isn ' t provided the control behavior ' s result will be returned immediately .
def run
        return run_control unless candidate? && enabled?
        timestamp = Time.now
        if control_runs_first?
          control   = observe_control
          candidate = observe_candidate
        else
          candidate = observe_candidate
          control   = observe_control
        end
        payload = {
          :timestamp => timestamp,
          :candidate => candidate.payload,
          :control   => control.payload,
          :first     => control_runs_first? ? :control : :candidate
        }
        kind = evaluate control, candidate
        publish_with_context kind, payload
        raise control.exception if control.raised?
        control.value
      end
def run return run_control unless candidate? && enabled? timestamp = Time . now if control_runs_first? control = observe_control candidate = observe_candidate else candidate = observe_candidate control = observe_control end payload = { :timestamp => timestamp , :candidate => candidate . payload , :control => control . payload , :first => control_runs_first? ? :control : :candidate } kind = evaluate control , candidate publish_with_context kind , payload raise control . exception if control . raised? control . value end
Public: Run the control and candidate behaviors, timing each and
comparing the results.
Public : Run the control and candidate behaviors timing each and comparing the results .