class Grape::Attack::Options::ProcOrNumberValidator

Public Instance Methods

validate_each(record, attribute, value) click to toggle source
# File lib/grape/attack/options.rb, line 12
def validate_each(record, attribute, value)
  return true if value.is_a?(Numeric)
  return true if value.is_a?(Proc) && value.call.is_a?(Numeric)

  record.errors.add attribute, "must be either a proc resolving in a numeric or a numeric"
end