lib/onebox/helpers.rb in onebox-1.8.41 vs lib/onebox/helpers.rb in onebox-1.8.42
- old
+ new
@@ -126,11 +126,11 @@
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
end
http.request_head([uri.path, uri.query].join("?")) do |response|
code = response.code.to_i
- unless code === 200 || response.header['content-length'].blank?
+ unless code === 200 || Onebox::Helpers.blank?(response.header['content-length'])
return nil
end
return response.header['content-length']
end
end
@@ -157,11 +157,13 @@
def self.click_to_scroll_div(width = 690, height = 400)
"<div style=\"background:transparent;position:relative;width:#{width}px;height:#{height}px;top:#{height}px;margin-top:-#{height}px;\" onClick=\"style.pointerEvents='none'\"></div>"
end
def self.blank?(value)
- if value.respond_to?(:blank?)
- value.blank?
+ if value.nil?
+ true
+ elsif String === value
+ value.empty? || !(/[[:^space:]]/ === value)
else
value.respond_to?(:empty?) ? !!value.empty? : !value
end
end