class Grape::Validations::SingleAttributeIterator
Private Instance Methods
empty?(val)
click to toggle source
Primitives like Integers and Booleans don’t respond to empty?
. It could be possible to use blank?
instead, but
false.blank? => true
# File lib/grape/validations/single_attribute_iterator.rb, line 21 def empty?(val) val.respond_to?(:empty?) ? val.empty? : val.nil? end
yield_attributes(val, attrs) { |val, attr_name, empty?(val)| ... }
click to toggle source
# File lib/grape/validations/single_attribute_iterator.rb, line 8 def yield_attributes(val, attrs) return if skip?(val) attrs.each do |attr_name| yield val, attr_name, empty?(val) end end