Exception: LocoMotion::UnknownPartError
- Inherits:
-
StandardError
- Object
- StandardError
- LocoMotion::UnknownPartError
- Defined in:
- lib/loco_motion/errors.rb
Instance Method Summary collapse
-
#initialize(part, component, custom_message = nil) ⇒ UnknownPartError
constructor
A new instance of UnknownPartError.
Constructor Details
#initialize(part, component, custom_message = nil) ⇒ UnknownPartError
Returns a new instance of UnknownPartError.
3 4 5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/loco_motion/errors.rb', line 3 def initialize(part, component, = nil) no_parts_explanation = "No parts are defined on the component." default_explanation = "Valid parts are #{component.config.valid_parts.map(&:inspect).to_sentence}." has_parts = component.config.valid_parts.present? = [ "Unknown part #{part.inspect}.", "#{has_parts ? default_explanation : no_parts_explanation}" ].join(' ') super( || ) end |