strings 0.1.3 → 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2c169560954048d363eb109d4c2098c122d2882d3a4f52ba41065cf9ec14411e
4
- data.tar.gz: 051f5e21eb97227609ccc87f4e46b13c9ab48d9bf181435599872f335756b74e
3
+ metadata.gz: e8111a8f94d474b08df2f71900bbd8f39ead7aabc0e3dbfff6917b249bd3322f
4
+ data.tar.gz: e86f201edd293da81d6d82210cd4a2cf40ab6098e65edc3a8bb8d0e14849ddb7
5
5
  SHA512:
6
- metadata.gz: 27f4263a2874d1b3cee622a31254cf63dcd92d88c19208339f984ddbb3193088ff7fab4a5d0768114c262a57c70320c11534ef4e5eb1eb75521e677c58505776
7
- data.tar.gz: ec8ee3980d43c8a7e7481c5e6b1c3d60d4423e7fa3eaaebffc49b2dfd558a019e073a4267283e1ef6008bf5fa2699ef9e1f86f45e538445f99e337dbccd8ee54
6
+ metadata.gz: b16670dfae47bb27c8b7ab2464831fda91baed37d721ae88e5c5a9787a2db5ec888b500922bbd111107cee8d91823e70c7d3111818aed2adf419af524a6313dc
7
+ data.tar.gz: 3b6daf8eb6a5ed06ee0d1688b8fd688a3ec21527525db103132cd933f28b25576c55b4b530062f9f88bb0d097f618048eff45dee71a1abe5866e21eb8c74cbd9
@@ -1,5 +1,10 @@
1
1
  # Change log
2
2
 
3
+ ## [v0.1.4] - 2018-09-10
4
+
5
+ ### Fixed
6
+ * Fix align_center for multiline text with tight width by @DannyBen
7
+
3
8
  ## [v0.1.3] - 2018-08-28
4
9
 
5
10
  ### Changed
@@ -19,7 +24,8 @@
19
24
 
20
25
  * Inital implementation and release
21
26
 
22
- [v0.1.3]: https://github.com/piotrmurach/strings/compare/v0.1.1...v0.1.3
27
+ [v0.1.4]: https://github.com/piotrmurach/strings/compare/v0.1.3...v0.1.4
28
+ [v0.1.3]: https://github.com/piotrmurach/strings/compare/v0.1.2...v0.1.3
23
29
  [v0.1.2]: https://github.com/piotrmurach/strings/compare/v0.1.1...v0.1.2
24
30
  [v0.1.1]: https://github.com/piotrmurach/strings/compare/v0.1.0...v0.1.1
25
31
  [v0.1.0]: https://github.com/piotrmurach/strings/compare/v0.1.0
@@ -89,7 +89,7 @@ module Strings
89
89
  left_count = width_diff - right_count
90
90
  [fill * left_count, line, fill * right_count].join
91
91
  else
92
- text
92
+ line
93
93
  end
94
94
  end
95
95
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Strings
4
- VERSION = '0.1.3'
4
+ VERSION = '0.1.4'
5
5
  end # Strings
@@ -30,10 +30,18 @@ RSpec.describe Strings::Align, '#align' do
30
30
  it "centers multiline text" do
31
31
  text = "for there is no folly of the beast\nof the earth which\nis not infinitely\noutdone by the madness of men"
32
32
  expect(Strings::Align.align_center(text, 40)).to eq([
33
- " for there is no folly of the beast \n",
34
- " of the earth which \n",
35
- " is not infinitely \n",
36
- " outdone by the madness of men "
33
+ " for there is no folly of the beast \n",
34
+ " of the earth which \n",
35
+ " is not infinitely \n",
36
+ " outdone by the madness of men "
37
+ ].join)
38
+ end
39
+
40
+ it "centers multiline text with exact width" do
41
+ text = "the madness \nof men"
42
+ expect(Strings::Align.align_center(text, 12)).to eq([
43
+ "the madness \n",
44
+ " of men "
37
45
  ].join)
38
46
  end
39
47
 
@@ -50,20 +58,20 @@ RSpec.describe Strings::Align, '#align' do
50
58
  it "centers text with ansi codes" do
51
59
  text = "for \e[35mthere\e[0m is no folly of the beast\nof the \e[33mearth\e0m which\nis \e[34mnot infinitely\e[0m\n\e[33moutdone\e[0m by the madness of men"
52
60
  expect(Strings::Align.align_center(text, 40)).to eq([
53
- " for \e[35mthere\e[0m is no folly of the beast \n",
54
- " of the \e[33mearth\e0m which \n",
55
- " is \e[34mnot infinitely\e[0m \n",
56
- " \e[33moutdone\e[0m by the madness of men "
61
+ " for \e[35mthere\e[0m is no folly of the beast \n",
62
+ " of the \e[33mearth\e0m which \n",
63
+ " is \e[34mnot infinitely\e[0m \n",
64
+ " \e[33moutdone\e[0m by the madness of men "
57
65
  ].join)
58
66
  end
59
67
 
60
68
  it "centers multiline text with fill character '*'" do
61
69
  text = "for there is no folly of the beast\nof the earth which\nis not infinitely\noutdone by the madness of men"
62
70
  expect(Strings::Align.align(text, 40, direction: :center, fill: '*')).to eq([
63
- "***for there is no folly of the beast***\n",
64
- "***********of the earth which***********\n",
65
- "***********is not infinitely************\n",
66
- "*****outdone by the madness of men******"
71
+ "***for there is no folly of the beast***\n",
72
+ "***********of the earth which***********\n",
73
+ "***********is not infinitely************\n",
74
+ "*****outdone by the madness of men******"
67
75
  ].join)
68
76
  end
69
77
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: strings
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Piotr Murach
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-08-28 00:00:00.000000000 Z
11
+ date: 2018-09-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: strings-ansi