lib/arli/extensions.rb in arli-0.8.3 vs lib/arli/extensions.rb in arli-0.9.0
- old
+ new
@@ -4,6 +4,12 @@
gsub(/([A-Z]+)([A-Z][a-z])/, '\1_\2').
gsub(/([a-z\d])([A-Z])/, '\1_\2').
tr('-', '_').
downcase
end
+
+ def reformat_wrapped(width = 70, indent_with = 8)
+ ind = (' ' * indent_with)
+ (ind + self.gsub(/\s+/, ' ').gsub(/(.{1,#{width}})( |\Z)/, "\\1\n" + ind))
+ end
+
end