Sha256: 43c849c7c89d7bace9b5e46c0e65366d3660cbc2ac34ae78bf9962542bac3146

Contents?: true

Size: 504 Bytes

Versions: 10

Compression:

Stored size: 504 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
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
grape-0.19.2 lib/grape/validations.rb
grape-0.19.1 lib/grape/validations.rb
grape-0.19.0 lib/grape/validations.rb
grape-0.18.0 lib/grape/validations.rb
grape-0.17.0 lib/grape/validations.rb
grape-0.16.2 lib/grape/validations.rb
grape-0.16.1 lib/grape/validations.rb
grape-0.15.0 lib/grape/validations.rb
grape-0.14.0 lib/grape/validations.rb
grape-0.13.0 lib/grape/validations.rb