Sha256: 94a150b3f1ff5db9885c54bc87b25079302670805da48c9d14392c65a2eb6edc
Contents?: true
Size: 518 Bytes
Versions: 1
Compression:
Stored size: 518 Bytes
Contents
module Grape module Validations class ValuesValidator < Validator def initialize(attrs, options, required, scope) @values = options @required = required super end def validate_param!(attr_name, params) if (params[attr_name] || @required) && !(@values.is_a?(Proc) ? @values.call : @values).include?(params[attr_name]) raise Grape::Exceptions::Validation, param: @scope.full_name(attr_name), message_key: :values end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
grape-0.7.0 | lib/grape/validations/values.rb |