lib/makit/mp/string_mp.rb in makit-0.0.0 vs lib/makit/mp/string_mp.rb in makit-0.0.1

- old
+ new

@@ -72,26 +72,26 @@ end # Alias for set_json_value alias_method :assign, :set_json_value - def to_lines(max_length=80,indent_length=5) - if(self.length <= max_length) + def to_lines(max_length = 80, indent_length = 5) + if (self.length <= max_length) return self else indent = " " * indent_length words = self.split(" ") lines = [] line = "" words.each do |word| - if((line + word).length > max_length) + if ((line + word).length > max_length) lines << line line = indent + word else - if(line.length == 0) + if (line.length == 0) line = word else - line += " " + word + line += " " + word end end end lines << line return lines.join("\n")