class Definition::KeyConformError

Attributes

key[RW]

Public Class Methods

new(definition, message, key:, sub_errors: [], i18n_key: definition.name) click to toggle source
Calls superclass method Definition::ConformError::new
# File lib/definition/key_conform_error.rb, line 7
def initialize(definition, message, key:, sub_errors: [], i18n_key: definition.name)
  self.key = key
  super(definition, message, sub_errors: sub_errors, i18n_key: i18n_key)
end

Public Instance Methods

error_key_path() click to toggle source
# 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

Private Instance Methods

assign_parents() click to toggle source
# File lib/definition/key_conform_error.rb, line 26
def assign_parents
  sub_errors.each do |error|
    error.parent = self
  end
end