Module: Grape::Validations::ClassMethods
- Included in:
- API
- Defined in:
- lib/grape/validations.rb
Overview
This module is mixed into the API Class.
Instance Method Summary collapse
Instance Method Details
#document_attribute(names, opts) ⇒ Object
237 238 239 240 241 242 243 244 |
# File 'lib/grape/validations.rb', line 237 def document_attribute(names, opts) @last_description ||= {} @last_description[:params] ||= {} Array(names).each do |name| @last_description[:params][name[:full_name].to_s] ||= {} @last_description[:params][name[:full_name].to_s].merge!(opts) end end |
#params(&block) ⇒ Object
233 234 235 |
# File 'lib/grape/validations.rb', line 233 def params(&block) ParamsScope.new(api: self, &block) end |
#reset_validations! ⇒ Object
228 229 230 231 |
# File 'lib/grape/validations.rb', line 228 def reset_validations! settings.peek[:declared_params] = [] settings.peek[:validations] = [] end |