Sha256: 2159154f89bc679ceb64c156d999ad8f17176cf46e4495a9a098aef43031a63d
Contents?: true
Size: 837 Bytes
Versions: 36
Compression:
Stored size: 837 Bytes
Contents
# encoding: utf-8 unless "".respond_to?(:blank?) # blank? methods for several different class types class Object # Returns true if the object is nil or empty (if applicable) def blank? nil? || (respond_to?(:empty?) && empty?) end end # class Object class Numeric # Numerics can't be blank def blank? false end end # class Numeric class NilClass # Nils are always blank def blank? true end end # class NilClass class TrueClass # True is not blank. def blank? false end end # class TrueClass class FalseClass # False is always blank. def blank? true end end # class FalseClass class String # Strips out whitespace then tests if the string is empty. def blank? strip.empty? end end # class String end
Version data entries
36 entries across 36 versions & 7 rubygems