class Syskit::AmbiguousSpecialization
Exception raised by CompositionModel#instanciate when multiple specializations can be applied
Attributes
candidates[R]
The set of possible specializations given the model and the selection. This
is a list of [merged, set] tuples where set is a set of
specializations and merged the complete specialization model
composition_model[R]
The composition model that was being instanciated
selection[R]
@return [{String=>Model}] the specialization selector
Public Class Methods
new(composition_model, selection, candidates)
click to toggle source
# File lib/syskit/exceptions.rb, line 737 def initialize(composition_model, selection, candidates) @composition_model, @selection, @candidates = composition_model, selection, candidates end
Public Instance Methods
pretty_print(pp)
click to toggle source
# File lib/syskit/exceptions.rb, line 742 def pretty_print(pp) pp.text "there is an ambiguity in the instanciation of #{composition_model.short_name}" pp.breakable if selection.empty? pp.text "with no selection applied" else pp.text "with the following selection:" pp.nest(2) do pp.breakable pp.seplist(selection) do |keyvalue| key, value = *keyvalue if key.respond_to?(:short_name) key = key.short_name end value = value.each_required_model value = value.map do |v| if v.respond_to?(:short_name) then v.short_name else v.to_s end end pp.text "#{key} => #{value.join(",")}" end end end pp.breakable pp.text "the following specializations apply:" pp.nest(2) do pp.breakable pp.seplist(candidates) do |spec| pp.text spec[0].short_name end end end