class Datum::FormValidator::Validations::Presence

Public Instance Methods

call(name, value) click to toggle source
# File lib/datum/form_validator/validations/presence.rb, line 7
def call(name, value)
  valid?(value) ? {} : { error: :required, on: name }
end

Private Instance Methods

present?(value) click to toggle source
# File lib/datum/form_validator/validations/presence.rb, line 17
def present?(value)
  !value
    .to_s
    .empty?
end
valid?(value) click to toggle source
# File lib/datum/form_validator/validations/presence.rb, line 13
def valid?(value)
  present?(value)
end