class ClassyHash::SchemaViolationError
Raised when a validation fails. Allows ClassyHash#validate_full to continue validation and gather all errors.
Attributes
entries[R]
The list of errors passed to the constructor. Contains an Array of Hashes:
[ { full_path: ClassyHash.join_path(parent_path, key), message: "something the full_path was supposed to be" }, ... ]
Public Class Methods
new(errors = [])
click to toggle source
Initializes a schema violation error with the given list of schema errors
.
# File lib/classy_hash.rb, line 26 def initialize(errors = []) @entries = errors end
Public Instance Methods
to_s()
click to toggle source
Joins all errors passed to the constructor into a comma-separated String.
# File lib/classy_hash.rb, line 31 def to_s @msg ||= @entries.map{|e| begin "#{e[:full_path]} is not #{e[:message]}" rescue "ERR: #{e.inspect}" end }.join(', ') end