Exception: Roby::NoSuchChild
- Defined in:
- lib/roby/standard_errors.rb
Overview
Exception raised when a child is being resolved by role, but the role is not associated with any child
Instance Attribute Summary collapse
-
#known_children ⇒ {String=>Object}
readonly
The set of known children.
-
#object ⇒ Object
readonly
The object whose children we try to access.
-
#role ⇒ String
readonly
The role that failed to be resolved.
Instance Method Summary collapse
-
#initialize(object, role, known_children) ⇒ NoSuchChild
constructor
A new instance of NoSuchChild.
- #pretty_print(pp) ⇒ Object
Constructor Details
#initialize(object, role, known_children) ⇒ NoSuchChild
Returns a new instance of NoSuchChild.
584 585 586 587 588 |
# File 'lib/roby/standard_errors.rb', line 584 def initialize(object, role, known_children) super() @object, @role, @known_children = object, role, known_children end |
Instance Attribute Details
#known_children ⇒ {String=>Object} (readonly)
Returns the set of known children.
582 583 584 |
# File 'lib/roby/standard_errors.rb', line 582 def known_children @known_children end |
#object ⇒ Object (readonly)
Returns the object whose children we try to access.
578 579 580 |
# File 'lib/roby/standard_errors.rb', line 578 def object @object end |
#role ⇒ String (readonly)
Returns the role that failed to be resolved.
580 581 582 |
# File 'lib/roby/standard_errors.rb', line 580 def role @role end |
Instance Method Details
#pretty_print(pp) ⇒ Object
590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 |
# File 'lib/roby/standard_errors.rb', line 590 def pretty_print(pp) pp.text "#{object} has no child with the role '#{role}'" if known_children.empty? pp.text ", actually, it has no child at all" else pp.text ". Known children:" pp.nest(2) do known_children.each do |role, child| pp.breakable pp.text "#{role}: #{child}" end end end end |