Previous: Encoder Stage Up: Table of Contents Next: Writer Stage

Packager Stage

Once the Generator has been properly encoded in the Encoder stage, Rubinius packages the bytecode up as a CompiledMethod by creating a new CompiledMethod and setting a number of properties on it.

These properties are available on any CompiledMethod. You can retrieve the CompiledMethod from a Ruby Method object by calling executable on it.

The Packager stage also makes sure that any child generators (such as generators for blocks or methods) are also converted into compiled methods. These child compiled methods are included in the literals tuple of the parent compiled method.

Once the Generator has finished packaging itself as a CompiledMethod, it invokes the Writer stage, passing in the CompiledMethod as its input.

Files Referenced

Customization

In general, the package method is designed to populate the CompiledMethod with a group of variables. However, you could also use the packager to populate another object with the same interface. However, it would not necessarily be useful on its own, without additional customizations later on

Previous: Encoder Stage Up: Table of Contents Next: Writer Stage