Sha256: dcb813d4d353eea5be321f827cc9c7710e9815699c4e722db7c0815d8f475863

Contents?: true

Size: 407 Bytes

Versions: 3

Compression:

Stored size: 407 Bytes

Contents

module NxtSchema
  module Validators
    class Validator
      def self.register_as(*keys)
        keys.each do |key|
          NxtSchema::Validators::REGISTRY.register(key, self)
        end

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

      def translate_error(locale, **options)
        NxtSchema::Validators::ErrorMessages.resolve(locale, key, **options)
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
nxt_schema-1.0.2 lib/nxt_schema/validators/validator.rb
nxt_schema-1.0.1 lib/nxt_schema/validators/validator.rb
nxt_schema-1.0.0 lib/nxt_schema/validators/validator.rb