Sha256: 3434985bd47ec02ea9490d755ae8c33f98e9918eaba75317284b16fc1f03f6cd

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::VALIDATORS.register(key, self)
        end

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

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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
nxt_schema-0.1.2 lib/nxt_schema/validators/validator.rb
nxt_schema-0.1.1 lib/nxt_schema/validators/validator.rb
nxt_schema-0.1.0 lib/nxt_schema/validators/validator.rb