class Syskit::AmbiguousServiceSelection

Exception raised when a service is being selected by type, but multiple services are available within the component that match the requested type

@see NoMatchingService, UnknownServiceName

Attributes

candidates[R]

@return [Array<Models::BoundDataService>] the set of data services

that matched the requested type
required_service[R]

@return [Model<DataService>] the model of data service we were looking for

task_model[R]

@return [Model<Component>] the component on which we were looking

for a given service

Public Class Methods

new(task_model, required_service, candidates) click to toggle source
# File lib/syskit/exceptions.rb, line 213
def initialize(task_model, required_service, candidates)
    @task_model, @required_service, @candidates =
        task_model, required_service, candidates
end

Public Instance Methods

pretty_print(pp) click to toggle source
# File lib/syskit/exceptions.rb, line 218
def pretty_print(pp)
    pp.text "there is an ambiguity while looking for a service of type #{required_service} in #{task_model.short_name}"
    pp.breakable
    pp.text "candidates are:"
    pp.nest(2) do
        pp.breakable
        pp.seplist(candidates) do |service|
            pp.text(service.name || service.to_s)
        end
    end
end