Method: Grape::Validations::ValuesValidator#initialize
- Defined in:
- lib/grape/validations/validators/values.rb
#initialize(attrs, options, required, scope, **opts) ⇒ ValuesValidator
Returns a new instance of ValuesValidator.
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/grape/validations/validators/values.rb', line 6 def initialize(attrs, , required, scope, **opts) if .is_a?(Hash) @excepts = [:except] @values = [:value] @proc = [:proc] warn '[DEPRECATION] The values validator except option is deprecated. ' \ 'Use the except validator instead.' if @excepts raise ArgumentError, 'proc must be a Proc' if @proc && !@proc.is_a?(Proc) warn '[DEPRECATION] The values validator proc option is deprecated. ' \ 'The lambda expression can now be assigned directly to values.' if @proc else @excepts = nil @values = nil @proc = nil @values = end super end |