Sha256: f8c35b9679208e704c670b96214f2fc9c33c22f3caf910d6c9cfec8b6d544f48

Contents?: true

Size: 828 Bytes

Versions: 1

Compression:

Stored size: 828 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
      puts "---Experience selected----- #{@another_key}"
      if @store[@another_key]
        @store[@another_key].call
      end
    end

  end
end
#
# a = Foo.new.start do |config|
#
#   config.game_one('aa') do
#     '<div>       \n   </div>'
#   end
#
#   config.game_two('bb') do
#     '<div>       \n kjsdkaskfsajkfjk   </div>'
#   end
# end
#
# p a

Version data entries

1 entries across 1 versions & 1 rubygems

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