Registers the search_for named scope within the class that is used for searching.
963603
def register_named_scope! # :nodoc
      @klass.define_singleton_method(:search_for) do |query = '', options = {}|
        # klass may be different to @klass if the scope is called on a subclass
        klass = self
        definition = klass.scoped_search_definition

        search_scope = klass.all
        find_options = ScopedSearch::QueryBuilder.build_query(definition, query || '', options)
        search_scope = search_scope.where(find_options[:conditions])   if find_options[:conditions]
        search_scope = search_scope.includes(find_options[:include])   if find_options[:include]
        search_scope = search_scope.joins(find_options[:joins])        if find_options[:joins]
        search_scope = search_scope.reorder(find_options[:order])      if find_options[:order]
        search_scope = search_scope.references(find_options[:include]) if find_options[:include]

        search_scope
      end
    end
1265810
def register(name, _callable=None):
    
    def wrapper(_callable):
        registered_checks[name] = _callable
        return _callable

    # If function or class is given, do the registeration
    if _callable:
        return wrapper(_callable)

    return wrapper
1225414
def singleton(name, klass = nil, &block)
      @registry[name.to_sym] = Resolver::Singleton.new(block || klass)
    end
1115511
def register(cache):
	'''  '''

	global caches
	name = cache().name
	if not caches.has_key(name):
		caches[name] = cache
417012
def in_namespace(name)
      name ||= generate_name
      @scope = Scope.new(name, @scope)
      ns = NameSpace.new(self, @scope)
      yield(ns)
      ns
    ensure
      @scope = @scope.tail
    end
580308
def new_scope(names)
      values = names.collect { |n| self[n] }
      self.class.new(names, values, self)
    end
22536
protected void registerIfNamed(Class<?> from, Serializer<?> serializer)
	{
		if(from.isAnnotationPresent(Named.class))
		{
			Named named = from.getAnnotation(Named.class);
			QualifiedName key = new QualifiedName(named.namespace(), named.name());
			nameToSerializer.put(key, serializer);
			serializerToName.put(serializer, key);
		}
	}
1232867
def register(self, scope, *args, **kwargs):
    """"""
    self._assert_not_frozen()
    self.get_parser(scope).register(*args, **kwargs)
    deprecated_scope = self.known_scope_to_info[scope].deprecated_scope
    if deprecated_scope:
      self.get_parser(deprecated_scope).register(*args, **kwargs)
921559
def _call_scope(self, scope, *args, **kwargs):
        
        query = self.get_query()

        # We will keep track of how many wheres are on the query before running the
        # scope so that we can properly group the added scope constraints in the
        # query as their own isolated nested where statement and avoid issues.
        original_where_count = len(query.wheres)

        result = getattr(self._model, scope)(self, *args, **kwargs)

        if self._should_nest_wheres_for_scope(query, original_where_count):
            self._nest_wheres_for_scope(
                query, [0, original_where_count, len(query.wheres)]
            )

        return result or self
883932
public static void addScope(String className, String scope, String criteria) {

        if(!scopes.containsKey(className)){
            scopes.put(className, new HashMap<>());
        }
        scopes.get(className).put(scope, criteria);
    }
530900
def register(self, name, *slots):
        
        # setdefault initializes the object even if it exists. This is more efficient
        if name not in self:
            self[name] = Signal()

        for slot in slots:
            self[name].connect(slot)
942454
public void registerTemplateTypeNamesInScope(Iterable<TemplateType> keys, Node scopeRoot) {
    for (TemplateType key : keys) {
      scopedNameTable.put(scopeRoot, key.getReferenceName(), key);
    }
  }
93724
def register_fn(cls, f):
        """"""
        def inner(self, *args, **kwargs):
            try:
                query, projection, options = cls.unpack_scope(f(*args, **kwargs))
                new_query = deepcopy(self.query)
                new_projection = deepcopy(self.projection)
                new_options = deepcopy(self.options)
                deep_merge(query, new_query)
                new_projection.update(projection)
                new_options.update(options)
                return ScopeBuilder(self.model, self.fns, new_query,
                    new_projection, new_options)
            except ValueError:
                raise ValueError("Scope function \"{}\ returns an invalid scope".format(f.__name__))

        setattr(cls, f.__name__, inner)
1030235
def register_lookup(self, lookup):
        """"""
        if lookup.operator in self._lookups:
            raise KeyError("Lookup for operator '{}' is already registered".format(lookup.operator))

        self._lookups[lookup.operator] = lookup()
1093635
def lookup_in_scope(name, scope)
      loop do
        tn = scope.path_with_task_name(name)
        task = @tasks[tn]
        return task if task
        break if scope.empty?
        scope = scope.tail
      end
      nil
    end
719856
def register(name):
    """"""
    def decorator(class_):
        if name in known_resolvers:
            raise ValueError('duplicate resolver name "%s"' % name)
        known_resolvers[name] = class_
    return decorator
1274879
def lookup_in_scope(name, scope)
      n = scope.size
      while n >= 0
        tn = (scope[0,n] + [name]).join(':')
        task = @tasks[tn]
        return task if task
        n -= 1
      end
      nil
    end