Sha256: 8283aa854a74b92133627bcbe437ab4929226fd6af26f0549d24a294b0a493c0

Contents?: true

Size: 675 Bytes

Versions: 1

Compression:

Stored size: 675 Bytes

Contents

module OptimizelyServerSide
  class Experiment

    def initialize(key)
      @another_key = key
      @store = {}
    end

    def start
      yield(self)
      self.compute
    end

    def variation_one(key, &blk)
      @store[key] = blk
    end

    def variation_two(key, &blk)
      @store[key] = blk
    end

    def variation_three(key, &blk)
      @store[key] = blk
    end

    def variation_default(key, &blk)
      @store[key] = blk
    end

    def compute
      ActiveSupport::Notifications.instrument "variation.variation", variation: @another_key do
        if @store[@another_key]
          @store[@another_key].call
        end
      end
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
optimizely_server_side-0.0.5 lib/optimizely_server_side/experiment.rb