Sha256: bacfa8e0235bf50b9767f675b38f5c148f3f8cdd7209c64d500d9d7bd4adde47

Contents?: true

Size: 693 Bytes

Versions: 7

Compression:

Stored size: 693 Bytes

Contents

require "rails"

module Abtest
  # Register a test.  This method takes the following parameters:
  # name:               Name of the experiment.
  # test:               A lambda used to determine whether or not to activate this test.  The provided
  #                     lambda must return a truthy value for the test to be activated and accept a request object.
  # process (optional): Lambda to run in the case of a test being activated.  Will be passed the controller object.
  def self.register_test(name, test, process = nil)
    abtest_config.registered_tests.add({name: name, check: test, process: process})
  end

  def self.abtest_config
    Rails.application.config.abtest
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
abtest-2.0.0 lib/abtest/registry.rb
abtest-1.0.1 lib/abtest/registry.rb
abtest-1.0.0 lib/abtest/registry.rb
abtest-0.1.2 lib/abtest/registry.rb
abtest-0.1.1 lib/abtest/registry.rb
abtest-0.1.0 lib/abtest/registry.rb
abtest-0.0.7 lib/abtest/registry.rb