Class: Definition::KeyConformError
- Inherits:
-
ConformError
- Object
- ConformError
- Definition::KeyConformError
- Defined in:
- lib/definition/key_conform_error.rb
Instance Attribute Summary collapse
-
#key ⇒ Object
Returns the value of attribute key.
Attributes inherited from ConformError
#definition, #i18n_context, #i18n_key, #message, #parent, #sub_errors, #translated_error
Instance Method Summary collapse
- #error_key_path ⇒ Object
-
#initialize(definition, message, key:, sub_errors: [], **options) ⇒ KeyConformError
constructor
A new instance of KeyConformError.
Methods inherited from ConformError
#error_path, #json_pointer, #leaf_errors, #to_s
Constructor Details
#initialize(definition, message, key:, sub_errors: [], **options) ⇒ KeyConformError
Returns a new instance of KeyConformError.
7 8 9 10 |
# File 'lib/definition/key_conform_error.rb', line 7 def initialize(definition, , key:, sub_errors: [], **) self.key = key super(definition, , sub_errors: sub_errors, **) end |
Instance Attribute Details
#key ⇒ Object
Returns the value of attribute key.
12 13 14 |
# File 'lib/definition/key_conform_error.rb', line 12 def key @key end |
Instance Method Details
#error_key_path ⇒ Object
14 15 16 17 18 19 20 21 22 |
# File 'lib/definition/key_conform_error.rb', line 14 def error_key_path path = [key] while (current = parent) next unless current.is_a?(KeyConformError) path += [current.key] end path.reverse end |