Class RGen::Instantiator::ReferenceResolver
In: lib/rgen/instantiator/reference_resolver.rb
Parent: Object

The ReferenceResolver can be used to resolve unresolved references, i.e. instances of class UnresolvedReference

There are two ways how this can be used:

 1. the identifiers and associated model elements are added upfront using +add_identifier+
 2. register an :identifier_resolver with the constructor, which will be invoked
    for every unresolved identifier

Methods

add_identifier   new   resolve  

Classes and Modules

Class RGen::Instantiator::ReferenceResolver::UnresolvedReference

Public Class methods

Create a reference resolver, options:

 :identifier_resolver:
   a proc which is called with an identifier and which should return the associated element
   in case the identifier is not uniq, the proc may return multiple values
   default: lookup element in internal map

Public Instance methods

Add an identifer / element pair which will be used for looking up unresolved identifers

Tries to resolve the given unresolved_refs. If resolution is successful, the proxy object will be removed, otherwise there will be an error description in the problems array. In case the resolved target element‘s type is not valid for the given feature, the target_type_error flag will be set on the unresolved reference. Returns an array of the references which are still unresolved. Options:

 :problems
   an array to which problems will be appended

 :on_resolve
   a proc which will be called for every sucessful resolution, receives the unresolved
   reference as well as to new target element

 :use_target_type
   use the expected target type to narrow the set of possible targets
   (i.e. ignore targets with wrong type)

 :failed_resolutions
   a Hash which will receive an entry for each failed resolution for which at least one
   target element was found (wrong target type, or target not unique).
   hash key is the uref, hash value is the target element or the Array of target elements

[Validate]