Sha256: fa9ecf9e4e3512f16da7fabccca28a5a5e0b598bbbf1c6642e2f36fce62a246b
Contents?: true
Size: 324 Bytes
Versions: 9
Compression:
Stored size: 324 Bytes
Contents
require 'active_model' # validates :key, 'quby/type': {is_a: Symbol} module Quby::Compiler class TypeValidator < ActiveModel::EachValidator def validate_each(record, attribute, value) return if value.is_a? options[:is_a] record.errors.add(attribute, "Is not of type #{options[:is_a]}") end end end
Version data entries
9 entries across 9 versions & 1 rubygems