class NxtSchema::Validators::Validator

Public Class Methods

register_as(*keys) click to toggle source
# File lib/nxt_schema/validators/validator.rb, line 4
def self.register_as(*keys)
  keys.each do |key|
    NxtSchema::Validators::REGISTRY.register(key, self)
  end

  define_method('key') { @key ||= keys.first }
end

Public Instance Methods

translate_error(locale, **options) click to toggle source
# File lib/nxt_schema/validators/validator.rb, line 12
def translate_error(locale, **options)
  NxtSchema::Validators::ErrorMessages.resolve(locale, key, **options)
end