Sha256: eac608dd913fc374cccc7756857d4b9245f2a19799da63b79bf809dade5884ca
Contents?: true
Size: 380 Bytes
Versions: 7
Compression:
Stored size: 380 Bytes
Contents
module Validatable class ValidatesInclusionOf < Validatable::ValidationBase required_option :within def valid?(instance) value = instance.send(attribute) return true if allow_nil && value.nil? return true if allow_blank && value.blank? within.include?(value) end def message(instance) super || "is not included" end end end
Version data entries
7 entries across 7 versions & 1 rubygems