word_wrap 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e1a70d32334b66e7ff236e50a9760340b8cba324
4
- data.tar.gz: 9f4045c589881e6b5c2dfc0193a6403eff6a9cfe
3
+ metadata.gz: 6bed1b27447155f0f5e043578f34575d1085e8ae
4
+ data.tar.gz: 09d3be25f57cc210a25d10409db9f3f37553bb9b
5
5
  SHA512:
6
- metadata.gz: acc7097f0cd8d3d363a97ed348db10d244d559d7aaf560847b98443a7bd38afcf9a84288d6a8b8d9583ebe1614cbff61b3bfda5df45ed5e9851c01c3fb1e1939
7
- data.tar.gz: efbef2079ef2de68025e1a6f46ba102641aafb9f4960b0bc280bb53bc349bc64c3f19c902157699acc1cf4e89317229c782761a11d928f5296edb85a2fc9e544
6
+ metadata.gz: 46c847775b94f223e5987a6859aba87cd4f703d28f841b4a264d9f49aba2b5dcab6935651eb495eb0e0eea13dbe41a54cd364734a2bf65bd3fe02be6643f9947
7
+ data.tar.gz: 254ab4e7b1d4cc3abaee28ffc8233dc6743732f901e0864a52df2f09f0e39c5069fdc7811bc2ad24b49f7af41eb7783fd13937ec6c306e75c585c1071622c8e5
@@ -18,7 +18,15 @@ class String
18
18
  WordWrap.ww(self, width, false)
19
19
  end
20
20
 
21
+ def wrap!(width=DEFAULT_WIDTH)
22
+ replace wrap(width)
23
+ end
24
+
21
25
  def fit(width=DEFAULT_WIDTH)
22
26
  WordWrap.ww(self, width, true)
23
27
  end
28
+
29
+ def fit!(width=DEFAULT_WIDTH)
30
+ replace fit(width)
31
+ end
24
32
  end
@@ -1,3 +1,3 @@
1
1
  module WordWrap
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.1"
3
3
  end
@@ -151,7 +151,7 @@ EOF
151
151
  wrapped = WordWrap.ww(text, 10, true)
152
152
  wrapped.should eql expected
153
153
  end
154
-
154
+
155
155
  it "works without breaks" do
156
156
  text =<<EOF
157
157
  0123456789012345678 9
@@ -268,5 +268,27 @@ letterpress iPhone.
268
268
  EOF
269
269
  text.fit(20).should eql expected
270
270
  end
271
+
272
+ it "wraps in-place" do
273
+ text = "0123456789 01234 0123456"
274
+ expected =<<EOF
275
+ 0123456789
276
+ 01234
277
+ 0123456
278
+ EOF
279
+ text.wrap! 10
280
+ text.should eql expected
281
+ end
282
+
283
+ it "fits in-place" do
284
+ text = "0123456789 01234 0123456"
285
+ expected =<<EOF
286
+ 0123456789
287
+ 01234
288
+ 0123456
289
+ EOF
290
+ text.fit! 10
291
+ text.should eql expected
292
+ end
271
293
  end
272
294
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: word_wrap
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Radek Pazdera