lib/detour/configuration.rb
# Allows for methods of the form `define_user_group` that call the private
# method `define_group_for_class`. A new group for any `User` records will
# be created that rollouts can be attached to.
#
# @example
#   Detour.config.define_user_group :admins do |user|
#     user.admin?
#   end
Allows for methods of the form `define_user_group` that call the private
method `define_group_for_class`. A new group for any `User` records will
be created that rollouts can be attached to.
Allows for methods of the form ` define_user_group ` that call the private method ` define_group_for_class ` . A new group for any ` User ` records will be created that rollouts can be attached to .
def method_missing(method, *args, &block)
    if /^define_(?<klass>[a-z0-9_]+)_group/ =~ method
      define_group_for_class(klass.classify, args[0], &block)
    else
      super
    end
  end
def method_missing ( method , * args , & block ) if / ^define_(?<klass>[a-z0-9_]+)_group / =~ method define_group_for_class ( klass . classify , args [ 0 ] , & block ) else super end end
Allows for methods of the form `define_user_group` that call the private
method `define_group_for_class`.
Allows for methods of the form ` define_user_group ` that call the private method ` define_group_for_class ` .
method
args
block
example
Detour.config.define_user_group :admins do |user| user.admin. end
Detour . config . define_user_group : admins do |user| user . admin . end