Sha256: ec45666c2590a5f2ef2e7500ad9bde0c80d7b3d5bc9fc719a6d469a7e95a1eb3

Contents?: true

Size: 595 Bytes

Versions: 13

Compression:

Stored size: 595 Bytes

Contents

module Grape
  # Registry to store and locate known Validators.
  module Validations
    class << self
      attr_accessor :validators
    end

    self.validators = {}

    # Register a new validator, so it can be used to validate parameters.
    # @param short_name [String] all lower-case, no spaces
    # @param klass [Class] the validator class. Should inherit from
    #   Validations::Base.
    def self.register_validator(short_name, klass)
      validators[short_name] = klass
    end

    def self.deregister_validator(short_name)
      validators.delete(short_name)
    end
  end
end

Version data entries

13 entries across 13 versions & 2 rubygems

Version Path
grape-extra_validators-2.0.0 vendor/bundle/ruby/2.6.0/gems/grape-1.2.5/lib/grape/validations.rb
grape-extra_validators-1.0.0 vendor/bundle/ruby/2.4.0/gems/grape-1.2.5/lib/grape/validations.rb
grape-1.2.5 lib/grape/validations.rb
grape-1.2.4 lib/grape/validations.rb
grape-1.2.3 lib/grape/validations.rb
grape-1.2.2 lib/grape/validations.rb
grape-1.2.1 lib/grape/validations.rb
grape-1.2.0 lib/grape/validations.rb
grape-1.1.0 lib/grape/validations.rb
grape-1.0.3 lib/grape/validations.rb
grape-1.0.2 lib/grape/validations.rb
grape-1.0.1 lib/grape/validations.rb
grape-1.0.0 lib/grape/validations.rb