module Experimental::Population::Filter

Public Class Methods

extended(base) click to toggle source
# File lib/experimental/population/filter.rb, line 4
def self.extended(base)
  base.reset_population_filters
end

Public Instance Methods

find_population(name) click to toggle source
# File lib/experimental/population/filter.rb, line 8
def find_population(name)
  if name.blank?
    Experimental::Population::Default
  else
    filter_classes[name.to_s]
  end
end
register_population_filter(name, filter_class) click to toggle source
# File lib/experimental/population/filter.rb, line 16
def register_population_filter(name, filter_class)
  filter_classes[name.to_s] = filter_class
end
reset_population_filters() click to toggle source
# File lib/experimental/population/filter.rb, line 20
def reset_population_filters
  filter_classes.clear
  register_population_filter(:new_users, NewUsers)
  register_population_filter(:default, Default)
end

Private Instance Methods

filter_classes() click to toggle source
# File lib/experimental/population/filter.rb, line 28
def filter_classes
  @filter_classes ||= {}
end