Sha256: 65a3655007b7b36123568a4136cd0e124c5a0b0b620a64c482c4e20ad8e453c3

Contents?: true

Size: 344 Bytes

Versions: 1

Compression:

Stored size: 344 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, param: @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.6.1 lib/grape/validations/regexp.rb