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 +4 -4
- data/CHANGELOG.md +7 -1
- data/lib/strings/align.rb +1 -1
- data/lib/strings/version.rb +1 -1
- data/spec/unit/align/align_spec.rb +20 -12
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e8111a8f94d474b08df2f71900bbd8f39ead7aabc0e3dbfff6917b249bd3322f
|
4
|
+
data.tar.gz: e86f201edd293da81d6d82210cd4a2cf40ab6098e65edc3a8bb8d0e14849ddb7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b16670dfae47bb27c8b7ab2464831fda91baed37d721ae88e5c5a9787a2db5ec888b500922bbd111107cee8d91823e70c7d3111818aed2adf419af524a6313dc
|
7
|
+
data.tar.gz: 3b6daf8eb6a5ed06ee0d1688b8fd688a3ec21527525db103132cd933f28b25576c55b4b530062f9f88bb0d097f618048eff45dee71a1abe5866e21eb8c74cbd9
|
data/CHANGELOG.md
CHANGED
@@ -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.
|
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
|
data/lib/strings/align.rb
CHANGED
data/lib/strings/version.rb
CHANGED
@@ -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
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
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
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
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
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
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.
|
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-
|
11
|
+
date: 2018-09-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: strings-ansi
|