class Pakyow::Validator::Result
Public Class Methods
new(key)
click to toggle source
# File lib/pakyow/validator.rb, line 11 def initialize(key) @key = key @errors = [] end
Public Instance Methods
error(validation, options)
click to toggle source
# File lib/pakyow/validator.rb, line 16 def error(validation, options) @errors << [validation, options] end
messages(type: :default)
click to toggle source
# File lib/pakyow/validator.rb, line 24 def messages(type: :default) @errors.map { |validation, options| Verifier.formatted_message( (options[:message] || validation.message(**options)), type: type, key: @key ) } end
valid?()
click to toggle source
# File lib/pakyow/validator.rb, line 20 def valid? @errors.empty? end