Object
All validators must inherit from this class.
We define Validator::inherited here so SingleOptionValidator will not be considered a validator.
# File lib/grape/validations.rb, line 42 def self.convert_to_short_name(klass) ret = klass.name.gsub(/::/, '/') .gsub(/([A-Z]+)([A-Z][a-z])/, '\1_\2') .gsub(/([a-z\d])([A-Z])/, '\1_\2') .tr("-", "_") .downcase File.basename(ret, '_validator') end
# File lib/grape/validations.rb, line 15 def validate!(params) attributes = AttributesIterator.new(self, @scope, params) attributes.each do |resource_params, attr_name| if @required || resource_params.key?(attr_name) validate_param!(attr_name, resource_params) end end end
Generated with the Darkfish Rdoc Generator 2.