lib/onebox/helpers.rb in onebox-2.1.5 vs lib/onebox/helpers.rb in onebox-2.1.6

- old
+ new

@@ -154,9 +154,10 @@ value.respond_to?(:empty?) ? !!value.empty? : !value end end def self.truncate(string, length = 50) + return string if string.nil? string.size > length ? string[0...(string.rindex(" ", length) || length)] + "..." : string end def self.get(meta, attr) (meta && !blank?(meta[attr])) ? sanitize(meta[attr]) : nil