swak 0.0.8 → 0.0.9
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/swak.rb +5 -0
- metadata +1 -1
data/lib/swak.rb
CHANGED
@@ -16,6 +16,11 @@ class String
|
|
16
16
|
color_int = AnsiMap[color]
|
17
17
|
return "[#{fg ? 3 : 4}#{color_int}m#{self}[#{fg ? 3 : 4}9m"
|
18
18
|
end
|
19
|
+
|
20
|
+
def wrap(max_chars_per_line=80)
|
21
|
+
return gsub(/\n/," ").scan(/\S.{0,#{max_chars_per_line-2}}\S(?=\s|$)|\S+/).join("\n")
|
22
|
+
end
|
23
|
+
|
19
24
|
end
|
20
25
|
|
21
26
|
#######################################################
|