Class: Object
- Inherits:
- BasicObject
- Defined in:
- lib/object_extensions.rb
Overview
Synopsis
add a blank? method to all Objects
Instance Method Summary collapse
-
#blank? ⇒ Boolean
return asserted if object is nil or empty TODO: not the safest coding, probably should dup before stripping.
Instance Method Details
#blank? ⇒ Boolean
return asserted if object is nil or empty TODO: not the safest coding, probably should dup before stripping. Maybe should also compact
6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/object_extensions.rb', line 6 def blank? result = nil? unless result if respond_to? 'empty?' if respond_to? 'strip' result = strip.empty? else result = empty? end end end result end |