Sha256: 83f01364abb419c906eb4865d2dc99b27525661757f3628f1e5928a42b1b6750
Contents?: true
Size: 596 Bytes
Versions: 7
Compression:
Stored size: 596 Bytes
Contents
# frozen_string_literal: true module Grape module Validations class SingleAttributeIterator < AttributesIterator private def yield_attributes(val, attrs) return if skip?(val) attrs.each do |attr_name| yield val, attr_name, empty?(val) end end # Primitives like Integers and Booleans don't respond to +empty?+. # It could be possible to use +blank?+ instead, but # # false.blank? # => true def empty?(val) val.respond_to?(:empty?) ? val.empty? : val.nil? end end end end
Version data entries
7 entries across 7 versions & 1 rubygems