Sha256: b9cb7524b10052f01de87b28aa702769afa68886d21da753d4a342507df27386
Contents?: true
Size: 541 Bytes
Versions: 8
Compression:
Stored size: 541 Bytes
Contents
# stolen from ActiveSupport class Object def blank? respond_to?(:empty?) ? empty? : !self end def present? !blank? end def presence self if present? end end class NilClass def blank? true end end class FalseClass def blank? true end end class TrueClass def blank? false end end class Array alias_method :blank?, :empty? end class Hash alias_method :blank?, :empty? end class String def blank? self !~ /[^[:space:]]/ end end class Numeric def blank? false end end
Version data entries
8 entries across 8 versions & 3 rubygems