lib/object_extensions.rb in royw-dvdprofiler_collection-0.0.2 vs lib/object_extensions.rb in royw-dvdprofiler_collection-0.0.3

- old
+ new

@@ -1,18 +1,21 @@ # == Synopsis # add a blank? method to all Objects class Object my_extension("blank?") do # return asserted if object is nil or empty - # TODO: not the safest coding, probably should dup before stripping. Maybe should also compact def blank? result = nil? unless result if respond_to? 'empty?' if respond_to? 'strip' result = strip.empty? else - result = empty? + if respond_to? 'compact' + result = compact.empty? + else + result = empty? + end end end end result end