Sha256: 7abaa8728f4ba1ea87f4d5cc3ce3de2980c30f25c379163119a631719bac2d29
Contents?: true
Size: 505 Bytes
Versions: 2
Compression:
Stored size: 505 Bytes
Contents
# frozen_string_literal: true module Grape module Validations class RegexpValidator < Base def validate_param!(attr_name, params) return unless params.respond_to?(:key?) && params.key?(attr_name) return if Array.wrap(params[attr_name]).all? { |param| param.nil? || (param.to_s =~ (options_key?(:value) ? @option[:value] : @option)) } raise Grape::Exceptions::Validation.new(params: [@scope.full_name(attr_name)], message: message(:regexp)) end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
grape-1.3.1 | lib/grape/validations/validators/regexp.rb |
grape-1.3.0 | lib/grape/validations/validators/regexp.rb |