Module | ForwardReferencing |
In: |
lib/forward_referencing.rb
|
The ForwardReferencing module can be mixed into a class to allow it to capture and resolve ForwardReferences.
forward_references | [R] | An array containing the set of unresolved forward references. |
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.
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.