Sha256: f8191bd09332128f063aff95c34abc229594203929c18ca1dc7926a5499969a1

Contents?: true

Size: 342 Bytes

Versions: 1

Compression:

Stored size: 342 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.7.0 lib/grape/validations/regexp.rb