lib/exodus/helpers/text_formatter.rb in exodus-1.0.5 vs lib/exodus/helpers/text_formatter.rb in exodus-1.0.6
- old
+ new
@@ -19,10 +19,12 @@
column_size = paragraphes.max_by{|paragraph| paragraph.size}.size
@full_text = Hash[*column_size.times.map {|i| [i,[]]}.flatten(1)]
paragraphes.each_with_index do |sentences, paragraph_number|
sentences.each_with_index do |sentence, column|
- if sentence.size > space_number && (words = sentence.gsub('=>', ' => ').split(' ')).size > 1
+ words = sentence.gsub('=>', ' => ').split(' ') || ''
+
+ if sentence.size > space_number && (words).size > 1
new_sentence = ""
words.each_with_index do |word, nb_word|
if new_sentence.size + word.size < space_number
new_sentence << word << ' '
else