verse 0.2.0 → 0.2.1
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 +5 -0
- data/lib/verse/alignment.rb +2 -1
- data/lib/verse/version.rb +1 -1
- data/spec/unit/alignment/align_spec.rb +7 -2
- data/spec/unit/alignment/left_spec.rb +7 -2
- data/spec/unit/alignment/right_spec.rb +6 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8bcfae40dd0a5d6e2cfe144f7ea30d7e7ee9519b
|
4
|
+
data.tar.gz: 0b661d9f8b3850dae81afbd029eb0cd9082ab369
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c48ef20fbcc3013a71f92059007022d1c37a7be054710af812540e2fbb3ed5bb73b05b966eb96cf9d58fa8473ff7bc1cf3467b3b8d2aabf0df230b2dcdd3162d
|
7
|
+
data.tar.gz: 077b69e6bad26f16c461ae1f9b903cec2789f5c6f0c15c9005b2854f24c017cf3aa637c1055729d1cc2c0b570796f17ca9316cefcb7977ef1d9797af5e1fde7b
|
data/CHANGELOG.md
CHANGED
data/lib/verse/alignment.rb
CHANGED
data/lib/verse/version.rb
CHANGED
@@ -12,6 +12,11 @@ RSpec.describe Verse::Alignment, '.align' do
|
|
12
12
|
}.to raise_error(ArgumentError, /Unknown alignment/)
|
13
13
|
end
|
14
14
|
|
15
|
+
it "fills empty" do
|
16
|
+
alignment = Verse::Alignment.new('')
|
17
|
+
expect(alignment.center(22)).to eq(" ")
|
18
|
+
end
|
19
|
+
|
15
20
|
it "centers line" do
|
16
21
|
text = "the madness of men"
|
17
22
|
alignment = Verse::Alignment.new(text)
|
@@ -25,7 +30,7 @@ RSpec.describe Verse::Alignment, '.align' do
|
|
25
30
|
end
|
26
31
|
|
27
32
|
it "centers multiline text" do
|
28
|
-
text = "for there is no folly of the beast\
|
33
|
+
text = "for there is no folly of the beast\nof the earth which\nis not infinitely\noutdone by the madness of men"
|
29
34
|
alignment = Verse::Alignment.new(text)
|
30
35
|
expect(alignment.center(40)).to eq([
|
31
36
|
" for there is no folly of the beast \n",
|
@@ -47,7 +52,7 @@ RSpec.describe Verse::Alignment, '.align' do
|
|
47
52
|
end
|
48
53
|
|
49
54
|
it "centers multiline text with fill of '*'" do
|
50
|
-
text = "for there is no folly of the beast\
|
55
|
+
text = "for there is no folly of the beast\nof the earth which\nis not infinitely\noutdone by the madness of men"
|
51
56
|
alignment = Verse::Alignment.new(text, fill: '*')
|
52
57
|
expect(alignment.center(40)).to eq([
|
53
58
|
"***for there is no folly of the beast***\n",
|
@@ -9,6 +9,11 @@ RSpec.describe Verse::Alignment, '.left' do
|
|
9
9
|
expect(alignment.left(22)).to eq("the madness of men ")
|
10
10
|
end
|
11
11
|
|
12
|
+
it "fills empty" do
|
13
|
+
alignment = Verse::Alignment.new('')
|
14
|
+
expect(alignment.left(22)).to eq(" ")
|
15
|
+
end
|
16
|
+
|
12
17
|
it "left justifies utf line" do
|
13
18
|
text = "こんにちは"
|
14
19
|
alignment = Verse::Alignment.new(text)
|
@@ -16,7 +21,7 @@ RSpec.describe Verse::Alignment, '.left' do
|
|
16
21
|
end
|
17
22
|
|
18
23
|
it "aligns multiline text to left" do
|
19
|
-
text = "for there is no folly of the beast\
|
24
|
+
text = "for there is no folly of the beast\nof the earth which\nis not infinitely\noutdone by the madness of men"
|
20
25
|
alignment = Verse::Alignment.new(text)
|
21
26
|
expect(alignment.left(40)).to eq([
|
22
27
|
"for there is no folly of the beast \n",
|
@@ -38,7 +43,7 @@ RSpec.describe Verse::Alignment, '.left' do
|
|
38
43
|
end
|
39
44
|
|
40
45
|
it "centers multiline text with fill of '*'" do
|
41
|
-
text = "for there is no folly of the beast\
|
46
|
+
text = "for there is no folly of the beast\nof the earth which\nis not infinitely\noutdone by the madness of men"
|
42
47
|
alignment = Verse::Alignment.new(text, fill: '*')
|
43
48
|
expect(alignment.left(40)).to eq([
|
44
49
|
"for there is no folly of the beast******\n",
|
@@ -9,6 +9,11 @@ RSpec.describe Verse::Alignment, '.right' do
|
|
9
9
|
expect(alignment.right(22)).to eq(" the madness of men")
|
10
10
|
end
|
11
11
|
|
12
|
+
it "fills empty" do
|
13
|
+
alignment = Verse::Alignment.new('')
|
14
|
+
expect(alignment.left(22)).to eq(" ")
|
15
|
+
end
|
16
|
+
|
12
17
|
it "right justifies utf line" do
|
13
18
|
text = "こんにちは"
|
14
19
|
alignment = Verse::Alignment.new(text)
|
@@ -38,7 +43,7 @@ RSpec.describe Verse::Alignment, '.right' do
|
|
38
43
|
end
|
39
44
|
|
40
45
|
it "centers multiline text with fill of '*'" do
|
41
|
-
text = "for there is no folly of the beast\
|
46
|
+
text = "for there is no folly of the beast\nof the earth which\nis not infinitely\noutdone by the madness of men"
|
42
47
|
alignment = Verse::Alignment.new(text, fill: '*')
|
43
48
|
expect(alignment.right(40)).to eq([
|
44
49
|
"******for there is no folly of the beast\n",
|