Sha256: 5b5a4039af60ccd2d89aa4ea347ee2181ca1ce989f7c7c2c1843552ba6fbe5dd
Contents?: true
Size: 548 Bytes
Versions: 2
Compression:
Stored size: 548 Bytes
Contents
# encoding: utf-8 # frozen_string_literal: true module Mixture module Validate # Checks to make sure that the value isn't in the given set. This # uses the `#includes?` method on the `@options`. class Exclusion < Base register_as :exclusion # Performs the validation. # # @param (see Base#validate) # @return (see Base#validate) def validate(record, attribute, value) super error("Value is in the given set") if @options[:in].include?(value) end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
mixture-0.7.1 | lib/mixture/validate/exclusion.rb |
mixture-0.7.0 | lib/mixture/validate/exclusion.rb |