Module ForwardReferencing
In: lib/forward_referencing.rb

The ForwardReferencing module can be mixed into a class to allow it to capture and resolve ForwardReferences.

Methods

Attributes

forward_references  [R]  An array containing the set of unresolved forward references.

Public Instance methods

To be called at the end of a section of code that could contain a forward reference, it will continue during normal processing and jump back to the resolve_forward_references method during resolution.

To be called when a section of code that could contain a forward reference is entered. The method returns a newly created ForwardReference with the given dependency that can be jumped to during resolution.

Returns a hash of dependencies to arrays of the ForwardReferences that have them as dependencies.

Returns the number of unresolved forward references.

Returns a string indicating the current state of ForwardReferencing.

To be called when a section of code that could contain a forward reference has successfully been reached. It is used to remove the ForwardReference that was created at the start of the section, and asserts that a resolution was made.

To be called to try to resolve any unresolved ForwardReferences by jumping to each in turn and retrying the code that caused it. This method repeats until nothing more is resolved. At that point unresolved forward reference may still exist, to be possibly resolved by another call to this method downstream. Prior to continuing to a forward reference, the establish_forward_reference context method is called with the context that was provided at the time the forward reference was created to give the receiver a chance to reset any transcient infromation.

To be called from the initializer of the includer, this sets up the forward reference capture and resolution mechanisms.

[Validate]