Module: Split

Extended by:
Split
Included in:
Split
Defined in:
lib/split/encapsulated_helper.rb,
lib/split.rb,
lib/split/user.rb,
lib/split/trial.rb,
lib/split/engine.rb,
lib/split/helper.rb,
lib/split/metric.rb,
lib/split/zscore.rb,
lib/split/version.rb,
lib/split/dashboard.rb,
lib/split/exceptions.rb,
lib/split/experiment.rb,
lib/split/alternative.rb,
lib/split/persistence.rb,
lib/split/configuration.rb,
lib/split/redis_interface.rb,
lib/split/goals_collection.rb,
lib/split/dashboard/helpers.rb,
lib/split/experiment_catalog.rb,
lib/split/algorithms/whiplash.rb,
lib/split/dashboard/paginator.rb,
lib/split/persistence/dual_adapter.rb,
lib/split/persistence/redis_adapter.rb,
lib/split/algorithms/weighted_sample.rb,
lib/split/persistence/cookie_adapter.rb,
lib/split/combined_experiments_helper.rb,
lib/split/persistence/session_adapter.rb,
lib/split/dashboard/pagination_helpers.rb,
lib/split/algorithms/block_randomization.rb

Overview

Selects alternative with minimum count of participants If all counts are even (i.e. all are minimum), samples from all possible alternatives

Defined Under Namespace

Modules: Algorithms, CombinedExperimentsHelper, DashboardHelpers, DashboardPaginationHelpers, EncapsulatedHelper, Helper, Persistence Classes: Alternative, Configuration, Dashboard, DashboardPaginator, Engine, Experiment, ExperimentCatalog, ExperimentNotFound, GoalsCollection, InvalidExperimentsFormatError, InvalidPersistenceAdapterError, Metric, RedisInterface, Trial, User, Zscore

Constant Summary collapse

MAJOR =
1
MINOR =
0
PATCH =
2
VERSION =
[MAJOR, MINOR, PATCH].join('.')

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#configurationObject

Returns the value of attribute configuration.



28
29
30
# File 'lib/split.rb', line 28

def configuration
  @configuration
end

Instance Method Details

#configure {|configuration| ... } ⇒ Object

Call this method to modify defaults in your initializers.

Examples:

Split.configure do |config|
  config.ignore_ip_addresses = '192.168.2.1'
end

Yields:



63
64
65
66
# File 'lib/split.rb', line 63

def configure
  self.configuration ||= Configuration.new
  yield(configuration)
end

#redisObject

Returns the current Redis connection. If none has been created, will create a new one.



51
52
53
54
55
# File 'lib/split.rb', line 51

def redis
  return @redis if @redis
  self.redis = self.configuration.redis
  self.redis
end

#redis=(server) ⇒ Object

Accepts:

1. A redis URL (valid for `Redis.new(url: url)`)
2. an options hash compatible with `Redis.new`
3. or a valid Redis instance (one that responds to `#smembers`). Likely,
   this will be an instance of either `Redis`, `Redis::Client`,
   `Redis::DistRedis`, or `Redis::Namespace`.


36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/split.rb', line 36

def redis=(server)
  @redis = if server.is_a?(String)
    Redis.new(:url => server, :thread_safe => true)
  elsif server.is_a?(Hash)
    Redis.new(server.merge(:thread_safe => true))
  elsif server.respond_to?(:smembers)
    server
  else
    raise ArgumentError,
      "You must supply a url, options hash or valid Redis connection instance"
  end
end