lib/scoped_attr_accessible/sanitizer.rb
def normalize_scope(object, context)
      return object if object.is_a?(Symbol)
      # 1. Process recognizers, looking for a match.
      @scope_recognizers.each_pair do |name, recognizers|
        return name if recognizers.any? { |r| lambda(&r).call(context, object) }
      end
      # 2. Process converters, finding a result.
      @scope_converters.each do |converter|
        scope = lambda(&converter).call(context, object)
        return normalize_scope(scope, converter) unless scope.nil?
      end
      # 3. Fall back to default
      return :default
    end
def normalize_scope(object, context)
      return object if object.is_a?(Symbol)
      # 1. Process recognizers, looking for a match.
      @scope_recognizers.each_pair do |name, recognizers|
        return name if recognizers.any? { |r| lambda(&r).call(context, object) }
      end
      # 2. Process converters, finding a result.
      @scope_converters.each do |converter|
        scope = lambda(&converter).call(context, object)
        return normalize_scope(scope, converter) unless scope.nil?
      end
      # 3. Fall back to default
      return :default
    end
Looks up a scope name from the registered recognizers and then from the converters.