class Dry::Validation::Message
Message
message
@api public
Attributes
Optional hash with meta-data
@return [Hash]
@api public
The path to the value with the error
@return [Array<Symbol, Integer>]
@api public
The error message text
@return [String] text
@api public
Public Class Methods
Source
# File lib/dry/validation/message.rb, line 60 def self.[](text, path, meta) klass = text.respond_to?(:call) ? Localized : Message klass.new(text, path: path, meta: meta) end
Build an error
@return [Message, Message::Localized
]
@api private
Source
# File lib/dry/validation/message.rb, line 69 def initialize(text, path:, meta: EMPTY_HASH) @text = text @path = Array(path) @meta = meta end
Initialize a new error object
@api private rubocop: disable Lint/MissingSuper
Public Instance Methods
Source
# File lib/dry/validation/message.rb, line 81 def base? @base ||= path.compact.empty? end
Check if this is a base error not associated with any key
@return [Boolean]
@api public
Source
# File lib/dry/validation/message.rb, line 90 def to_s text end
Dump error to a string
@return [String]
@api public