class Syskit::InvalidSelection

Raised when an incompatible dependency injection selection is given

Attributes

expected[R]

The expected model

key[R]

The selection key @return [nil,Object]

selected[R]

The selection

Public Class Methods

new(key, selected, expected) click to toggle source
# File lib/syskit/exceptions.rb, line 56
def initialize(key, selected, expected)
    @key, @selected, @expected = key, selected, expected
end

Public Instance Methods

pretty_print(pp) click to toggle source
# File lib/syskit/exceptions.rb, line 60
def pretty_print(pp)
    if key
        pp.text "invalid selection for #{key}"
        pp.breakable
        pp.text "got "
    else
        pp.text "invalid selection: got "
    end
    selected.pretty_print(pp)
    pp.breakable
    pp.text "which provides"
    pp.nest(2) do
        selected.each_fullfilled_model do |m|
            pp.breakable
            m.pretty_print(pp)
        end
    end
    pp.breakable
    pp.text "expected something that provides "
    expected.pretty_print(pp)
end