Exception: LocoMotion::InvalidModifierError
- Inherits:
-
StandardError
- Object
- StandardError
- LocoMotion::InvalidModifierError
- Defined in:
- lib/loco_motion/errors.rb
Overview
Raised when a component is given a modifier (via the modifier: /
modifiers: options) that isn't listed in that component's
valid_modifiers.
Instance Method Summary collapse
-
#initialize(modifier, component, custom_message = nil) ⇒ InvalidModifierError
constructor
A new instance of InvalidModifierError.
Constructor Details
#initialize(modifier, component, custom_message = nil) ⇒ InvalidModifierError
Returns a new instance of InvalidModifierError.
50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/loco_motion/errors.rb', line 50 def initialize(modifier, component, = nil) no_modifiers_explanation = "No modifiers are defined on the component." default_explanation = "Valid modifiers are #{component.valid_modifiers.map(&:inspect).to_sentence}." has_modifiers = component.valid_modifiers.present? = [ "Unknown modifier #{modifier.inspect}.", (has_modifiers ? default_explanation : no_modifiers_explanation).to_s ].join(" ") super( || ) end |