Sha256: f7c8a36a452366fcf648c7ef12641bc0fce3b8743ced45dda1a4cbfc4e914ce6

Contents?: true

Size: 388 Bytes

Versions: 1

Compression:

Stored size: 388 Bytes

Contents

module Grape
  module Validations
    class RegexpValidator < SingleOptionValidator
      def validate_param!(attr_name, params)
        if params.key?(attr_name) &&
          (params[attr_name].nil? || !(params[attr_name].to_s =~ @option))
          raise Grape::Exceptions::Validation, params: [@scope.full_name(attr_name)], message_key: :regexp
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
grape-0.9.0 lib/grape/validations/regexp.rb