Sha256: 2eee96d9fb393f1ede6af8359fbf74a3e0699f849516380529e984ae813cb559
Contents?: true
Size: 640 Bytes
Versions: 41
Compression:
Stored size: 640 Bytes
Contents
# The blank extension adds the blank? method to all objects (e.g. Object#blank?). class FalseClass # false is always blank def blank? true end end class Object # Objects are blank if they respond true to empty? def blank? respond_to?(:empty?) && empty? end end class NilClass # nil is always blank def blank? true end end class Numeric # Numerics are never blank (not even 0) def blank? false end end class String # Strings are blank if they are empty or include only whitespace def blank? strip.empty? end end class TrueClass # true is never blank def blank? false end end
Version data entries
41 entries across 41 versions & 2 rubygems