Sha256: fb15deeddfc59066124ce45017902424af82f52c8722fcc438ebf57199ee7494
Contents?: true
Size: 573 Bytes
Versions: 11
Compression:
Stored size: 573 Bytes
Contents
# frozen_string_literal: true module Grape module Validations module Validators class AllowBlankValidator < Base def validate_param!(attr_name, params) return if (options_key?(:value) ? @option[:value] : @option) || !params.is_a?(Hash) value = params[attr_name] value = value.strip if value.respond_to?(:strip) return if value == false || value.present? raise Grape::Exceptions::Validation.new(params: [@scope.full_name(attr_name)], message: message(:blank)) end end end end end
Version data entries
11 entries across 11 versions & 1 rubygems