Sha256: 4ecc539663f8efd9ce2d7f206478a636d6d06219a6412137b6b5f27c41db12f1

Contents?: true

Size: 268 Bytes

Versions: 33

Compression:

Stored size: 268 Bytes

Contents

# validates :key, 'quby/type': {is_a: Symbol}
class Quby::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

Version data entries

33 entries across 33 versions & 1 rubygems

Version Path
quby-5.6.5 lib/active_model_modules/type_validator.rb
quby-5.6.3 lib/active_model_modules/type_validator.rb
quby-5.6.2 lib/active_model_modules/type_validator.rb
quby-5.6.1 lib/active_model_modules/type_validator.rb
quby-5.6.0 lib/active_model_modules/type_validator.rb
quby-5.5.0 lib/active_model_modules/type_validator.rb
quby-5.4.0 lib/active_model_modules/type_validator.rb
quby-5.3.1 lib/active_model_modules/type_validator.rb
quby-5.3.0 lib/active_model_modules/type_validator.rb
quby-5.2.0 lib/active_model_modules/type_validator.rb
quby-5.1.3 lib/active_model_modules/type_validator.rb
quby-5.1.2 lib/active_model_modules/type_validator.rb
quby-5.1.1 lib/active_model_modules/type_validator.rb
quby-5.1.0 lib/active_model_modules/type_validator.rb
quby-5.0.5 lib/active_model_modules/type_validator.rb
quby-5.0.4 lib/active_model_modules/type_validator.rb
quby-5.0.3 lib/active_model_modules/type_validator.rb
quby-5.0.2 lib/active_model_modules/type_validator.rb
quby-5.0.1 lib/active_model_modules/type_validator.rb
quby-5.0.0 lib/active_model_modules/type_validator.rb