Exception: Syskit::InvalidSelection
- Defined in:
- lib/syskit/exceptions.rb
Overview
Raised when an incompatible dependency injection selection is given
Instance Attribute Summary collapse
-
#expected ⇒ Object
readonly
The expected model.
-
#key ⇒ nil, Object
readonly
The selection key.
-
#selected ⇒ Object
readonly
The selection.
Instance Method Summary collapse
-
#initialize(key, selected, expected) ⇒ InvalidSelection
constructor
A new instance of InvalidSelection.
- #pretty_print(pp) ⇒ Object
Constructor Details
#initialize(key, selected, expected) ⇒ InvalidSelection
Returns a new instance of InvalidSelection
56 57 58 |
# File 'lib/syskit/exceptions.rb', line 56 def initialize(key, selected, expected) @key, @selected, @expected = key, selected, expected end |
Instance Attribute Details
#expected ⇒ Object (readonly)
The expected model
53 54 55 |
# File 'lib/syskit/exceptions.rb', line 53 def expected @expected end |
#key ⇒ nil, Object (readonly)
The selection key
49 50 51 |
# File 'lib/syskit/exceptions.rb', line 49 def key @key end |
#selected ⇒ Object (readonly)
The selection
51 52 53 |
# File 'lib/syskit/exceptions.rb', line 51 def selected @selected end |
Instance Method Details
#pretty_print(pp) ⇒ Object
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
# 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 |