lib/onebox/helpers.rb in onebox-1.5.50 vs lib/onebox/helpers.rb in onebox-1.5.60
- old
+ new
@@ -53,7 +53,15 @@
end
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)
+ value.respond_to?(:empty?) ? !!value.empty? || !value[/\S/] : !value
+ end
+
+ def self.truncate(string, length = 50)
+ string.size > length ? string[0..length] + "..." : string
+ end
end
end