SCons.Environment.MethodWrapper

Package SCons :: Module Environment :: Class MethodWrapper |
[hide private]
[frames] | no frames]

# Class MethodWrapper

source code

Known Subclasses:
  BuilderWrapper

A generic Wrapper class that associates a method (which can actually be any callable) with an object. As part of creating this MethodWrapper object an attribute with the specified (by default, the name of the supplied method) is added to the underlying object. When that new "method" is called, our __call__() method adds the object as the first argument, simulating the Python behavior of supplying "self" on method calls.

We hang on to the name by which the method was added to the underlying base class so that we can provide a method to "clone" ourselves onto a new underlying object being copied (without which we wouldn't need to save that info).

Instance Methods | [hide private]
__init__(self, object, method, name=False) | source code
__call__(self, *args, **kwargs) | source code
clone(self, new_object) Returns an object that re-binds the underlying "method" to the specified new object. | source code