Sha256: 0a18e81b98e1e492af85b7fbe319a1df5f41adb936a1ad7ee7509cd1f41761a9
Contents?: true
Size: 439 Bytes
Versions: 2
Compression:
Stored size: 439 Bytes
Contents
# frozen_string_literal: true module ActiveFields module Validators class TextValidator < BaseValidator private def perform_validation(value) if value.nil? errors << :required if options[:required] elsif value.is_a?(String) validate_length(value, min: options[:min_length], max: options[:max_length]) else errors << :invalid end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
active_fields-1.1.0 | lib/active_fields/validators/text_validator.rb |
active_fields-1.0.0 | lib/active_fields/validators/text_validator.rb |