Module: Split
- Extended by:
- Split
- Included in:
- Split
- Defined in:
- lib/split/algorithms/whiplash.rb,
lib/split.rb,
lib/split/user.rb,
lib/split/cache.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/algorithms.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/dashboard/paginator.rb,
lib/split/encapsulated_helper.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, Cache, Configuration, Dashboard, DashboardPaginator, Engine, Experiment, ExperimentCatalog, ExperimentNotFound, GoalsCollection, InvalidExperimentsFormatError, InvalidPersistenceAdapterError, Metric, Railtie, RedisInterface, Trial, User, Zscore
Constant Summary collapse
- VERSION =
"4.0.4"
Instance Attribute Summary collapse
-
#configuration ⇒ Object
Returns the value of attribute configuration.
Instance Method Summary collapse
- #cache(namespace, key, &block) ⇒ Object
-
#configure {|configuration| ... } ⇒ Object
Call this method to modify defaults in your initializers.
-
#redis ⇒ Object
Returns the current Redis connection.
-
#redis=(server) ⇒ Object
Accepts: 1.
Instance Attribute Details
#configuration ⇒ Object
Returns the value of attribute configuration.
31 32 33 |
# File 'lib/split.rb', line 31 def configuration @configuration end |
Instance Method Details
#cache(namespace, key, &block) ⇒ Object
71 72 73 |
# File 'lib/split.rb', line 71 def cache(namespace, key, &block) Split::Cache.fetch(namespace, key, &block) end |
#configure {|configuration| ... } ⇒ Object
Call this method to modify defaults in your initializers.
66 67 68 69 |
# File 'lib/split.rb', line 66 def configure self.configuration ||= Configuration.new yield(configuration) end |
#redis ⇒ Object
Returns the current Redis connection. If none has been created, will create a new one.
54 55 56 57 58 |
# File 'lib/split.rb', line 54 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`.
39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/split.rb', line 39 def redis=(server) @redis = if server.is_a?(String) Redis.new(url: server) elsif server.is_a?(Hash) Redis.new(server) elsif server.respond_to?(:smembers) server else raise ArgumentError, "You must supply a url, options hash or valid Redis connection instance" end end |