word_count_analyzer 0.0.7 → 0.0.8
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
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 342d1a0ede90ade91de48b7d6305781ac07bce41
|
4
|
+
data.tar.gz: bbbf42aff382a2ac2005a30eeeec87a69aa34bad
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e63162459e6e8333a333a35c103cc7c3018385e64bacfa556a598c77e5ebb3f99ede9579b0dbb97511cc44fb14d9bddb46c3407cdc4a14c8c0097320c8dd30d1
|
7
|
+
data.tar.gz: c000538dcefc659cc5b92aecc71cdc703166546e2a0759245a4a67a0049b23d913b0403689eb31c089e9e972344d2d21294d3363d2dc9afb022d5aa9fe17b830
|
@@ -1,17 +1,17 @@
|
|
1
1
|
module WordCountAnalyzer
|
2
2
|
class Ellipsis
|
3
3
|
# Rubular: http://rubular.com/r/mfdtSeuIf2
|
4
|
-
FOUR_CONSECUTIVE_REGEX = /(?<=[^\.])\.{3}\.(?=[^\.])/
|
4
|
+
FOUR_CONSECUTIVE_REGEX = /(?<=[^\.]|\A)\.{3}\.(?=[^\.]|$)/
|
5
5
|
|
6
6
|
# Rubular: http://rubular.com/r/YBG1dIHTRu
|
7
7
|
THREE_SPACE_REGEX = /(\s\.){3}\s/
|
8
8
|
|
9
9
|
# Rubular: http://rubular.com/r/2VvZ8wRbd8
|
10
|
-
FOUR_SPACE_REGEX = /(?<=[a-z])(\.\s){3}\.(\z|$|\n)/
|
10
|
+
FOUR_SPACE_REGEX = /(?<=[a-z]|\A)(\.\s){3}\.(\z|$|\n)/
|
11
11
|
|
12
|
-
OTHER_THREE_PERIOD_REGEX = /(?<=[^\.])\.{3}(?=([^\.]|$))/
|
12
|
+
OTHER_THREE_PERIOD_REGEX = /(?<=[^\.]|\A)\.{3}(?=([^\.]|$))/
|
13
13
|
|
14
|
-
UNICODE_ELLIPSIS = /(?<=[^…])…{1}(?=[^…])/
|
14
|
+
UNICODE_ELLIPSIS = /(?<=[^…]|\A)…{1}(?=[^…]|$)/
|
15
15
|
|
16
16
|
attr_reader :string
|
17
17
|
def initialize(string:)
|
@@ -38,19 +38,49 @@ RSpec.describe WordCountAnalyzer::Ellipsis do
|
|
38
38
|
expect(ws.includes_ellipsis?).to eq(true)
|
39
39
|
end
|
40
40
|
|
41
|
-
it
|
41
|
+
it 'returns true if the string includes an ellipsis #007' do
|
42
|
+
string = '...'
|
43
|
+
ws = WordCountAnalyzer::Ellipsis.new(string: string)
|
44
|
+
expect(ws.includes_ellipsis?).to eq(true)
|
45
|
+
end
|
46
|
+
|
47
|
+
it 'returns true if the string includes an ellipsis #008' do
|
48
|
+
string = '....'
|
49
|
+
ws = WordCountAnalyzer::Ellipsis.new(string: string)
|
50
|
+
expect(ws.includes_ellipsis?).to eq(true)
|
51
|
+
end
|
52
|
+
|
53
|
+
it 'returns true if the string includes an ellipsis #009' do
|
54
|
+
string = ' . . . '
|
55
|
+
ws = WordCountAnalyzer::Ellipsis.new(string: string)
|
56
|
+
expect(ws.includes_ellipsis?).to eq(true)
|
57
|
+
end
|
58
|
+
|
59
|
+
it 'returns true if the string includes an ellipsis #010' do
|
60
|
+
string = ' . . . . '
|
61
|
+
ws = WordCountAnalyzer::Ellipsis.new(string: string)
|
62
|
+
expect(ws.includes_ellipsis?).to eq(true)
|
63
|
+
end
|
64
|
+
|
65
|
+
it 'returns true if the string includes an ellipsis #011' do
|
66
|
+
string = '…'
|
67
|
+
ws = WordCountAnalyzer::Ellipsis.new(string: string)
|
68
|
+
expect(ws.includes_ellipsis?).to eq(true)
|
69
|
+
end
|
70
|
+
|
71
|
+
it "returns false if the string doesn't include an ellipsis #012" do
|
42
72
|
string = 'Hello world.'
|
43
73
|
ws = WordCountAnalyzer::Ellipsis.new(string: string)
|
44
74
|
expect(ws.includes_ellipsis?).to eq(false)
|
45
75
|
end
|
46
76
|
|
47
|
-
it "returns false if the string includes a dotted_line #
|
77
|
+
it "returns false if the string includes a dotted_line #0013" do
|
48
78
|
string = '.....'
|
49
79
|
ws = WordCountAnalyzer::Ellipsis.new(string: string)
|
50
80
|
expect(ws.includes_ellipsis?).to eq(false)
|
51
81
|
end
|
52
82
|
|
53
|
-
it "returns false if the string includes a dotted_line #
|
83
|
+
it "returns false if the string includes a dotted_line #0014" do
|
54
84
|
string = "Here is one …………………………………………………………………… and another ......"
|
55
85
|
ws = WordCountAnalyzer::Ellipsis.new(string: string)
|
56
86
|
expect(ws.includes_ellipsis?).to eq(false)
|