Module: Arturo::SpecialHandling

Included in:
Feature
Defined in:
lib/arturo/special_handling.rb

Overview

Adds whitelist and blacklist support to individual features by name. Blacklists override whitelists. (In the world of Apache, Features are “(deny,allow)”.) Blacklists and whitelists can be defined before the feature exists and are not persisted, so they are best defined in initializers. This is particularly important if your application runs in several different processes or on several servers.

Examples:

# allow admins:
Arturo::Feature.whitelist(:some_feature) do |user|
  user.is_admin?
end

# disallow for small accounts:
Arturo::Feature.blacklist(:another_feature) do |user|
  user..small?
end

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Class Method Details

.included(base) ⇒ Object



23
24
25
# File 'lib/arturo/special_handling.rb', line 23

def self.included(base)
  base.extend Arturo::SpecialHandling::ClassMethods
end