lib/dvdprofiler2xbmc/extensions.rb in royw-dvdprofiler2xbmc-0.0.5 vs lib/dvdprofiler2xbmc/extensions.rb in royw-dvdprofiler2xbmc-0.0.6
- old
+ new
@@ -48,18 +48,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