Sha256: 1fd29d35a36ade750d50500c546553ce82b86baaeb5706327188b1a7cb309a84

Contents?: true

Size: 380 Bytes

Versions: 6

Compression:

Stored size: 380 Bytes

Contents

module Grape
  module Validations

    class RegexpValidator < SingleOptionValidator
      def validate_param!(attr_name, params)
        if params[attr_name] && !( params[attr_name].to_s =~ @option )
          raise Grape::Exceptions::Validation, :status => 400,
            :param => @scope.full_name(attr_name), :message_key => :regexp
        end
      end
    end

  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
grape-0.5.0 lib/grape/validations/regexp.rb
grape-0.4.1 lib/grape/validations/regexp.rb
grape-0.4.0 lib/grape/validations/regexp.rb
grape-0.3.2 lib/grape/validations/regexp.rb
grape-0.3.1 lib/grape/validations/regexp.rb
grape-0.3.0 lib/grape/validations/regexp.rb