Sha256: f6c88f6f486b741ebf08667cbbb04b034bea0f918850a0b71f318faddabcd3d4
Contents?: true
Size: 467 Bytes
Versions: 2
Compression:
Stored size: 467 Bytes
Contents
# frozen_string_literal: true module ActiveFields module Validators class BooleanValidator < BaseValidator private def perform_validation(value) if value.nil? errors << :exclusion unless options[:nullable] elsif value.is_a?(FalseClass) errors << :required if options[:required] elsif value.is_a?(TrueClass) nil 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/boolean_validator.rb |
active_fields-1.0.0 | lib/active_fields/validators/boolean_validator.rb |