integral-corrector 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +12 -0
- data/.reek.yml +6 -0
- data/.rspec +3 -0
- data/.rubocop.yml +133 -0
- data/.ruby-version +1 -0
- data/.travis.yml +7 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +269 -0
- data/LICENSE.txt +21 -0
- data/README.md +39 -0
- data/Rakefile +18 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/integral-corrector.gemspec +38 -0
- data/lib/integral/corrector/version.rb +5 -0
- data/lib/integral/corrector.rb +142 -0
- data/lib/integral/text_calculations.rb +15 -0
- data/temp/rspec-status.txt +24 -0
- metadata +202 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: d53cfc4d59d48982debc8bb118417dfab1a3b312197c8641c15bacc8ab2b4b6d
|
4
|
+
data.tar.gz: 9c813dc78adb16231b9ab48b101aa9e0749f624a9bc29afb8243abdee780ef73
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 55faed5f37bdaa4bd0ed09a7619917fa7b4fa074e021bf7d5c469645edf82aaa11a9dfbb74bc69dcc38ea5dc41863557553e18827ee9d601d9846563bfc343fb
|
7
|
+
data.tar.gz: fe97aaf79680c615dc23ee0e21c7c9edae329c2bbb397c5f10300730ec0bba853e1d21ed6723fcc5279fd8cde08653a4bb87f98c8fde231dc5fca423a515a0bc
|
data/.gitignore
ADDED
data/.reek.yml
ADDED
data/.rspec
ADDED
data/.rubocop.yml
ADDED
@@ -0,0 +1,133 @@
|
|
1
|
+
AllCops:
|
2
|
+
DisplayCopNames: true
|
3
|
+
Exclude:
|
4
|
+
- "db/schema.rb"
|
5
|
+
- "node_modules/**/*"
|
6
|
+
- "tmp/**/*"
|
7
|
+
- "vendor/**/*"
|
8
|
+
- "spec/**/*"
|
9
|
+
|
10
|
+
Layout/AlignHash:
|
11
|
+
EnforcedHashRocketStyle: table
|
12
|
+
|
13
|
+
Layout/CaseIndentation:
|
14
|
+
IndentOneStep: true
|
15
|
+
|
16
|
+
Layout/EmptyLineAfterGuardClause:
|
17
|
+
Enabled: false
|
18
|
+
|
19
|
+
Layout/EmptyLinesAroundClassBody:
|
20
|
+
Enabled: false
|
21
|
+
|
22
|
+
Layout/EmptyLinesAroundModuleBody:
|
23
|
+
Enabled: false
|
24
|
+
|
25
|
+
Layout/FirstArrayElementLineBreak:
|
26
|
+
Enabled: true
|
27
|
+
|
28
|
+
Layout/FirstHashElementLineBreak:
|
29
|
+
Enabled: true
|
30
|
+
|
31
|
+
Layout/FirstMethodArgumentLineBreak:
|
32
|
+
Enabled: true
|
33
|
+
|
34
|
+
Layout/FirstMethodParameterLineBreak:
|
35
|
+
Enabled: true
|
36
|
+
|
37
|
+
Layout/MultilineAssignmentLayout:
|
38
|
+
Enabled: true
|
39
|
+
EnforcedStyle: same_line
|
40
|
+
|
41
|
+
Layout/SpaceInsideHashLiteralBraces:
|
42
|
+
EnforcedStyle: no_space
|
43
|
+
|
44
|
+
Metrics/BlockLength:
|
45
|
+
Exclude:
|
46
|
+
- "**/*.gemspec"
|
47
|
+
- "spec/**/*"
|
48
|
+
|
49
|
+
Metrics/LineLength:
|
50
|
+
Max: 200
|
51
|
+
|
52
|
+
Metrics/ParameterLists:
|
53
|
+
Max: 3
|
54
|
+
|
55
|
+
Naming/VariableNumber:
|
56
|
+
EnforcedStyle: snake_case
|
57
|
+
|
58
|
+
Naming/UncommunicativeMethodParamName:
|
59
|
+
AllowedNames:
|
60
|
+
- "id"
|
61
|
+
- "io"
|
62
|
+
- "to"
|
63
|
+
|
64
|
+
Style/AndOr:
|
65
|
+
EnforcedStyle: conditionals
|
66
|
+
|
67
|
+
Style/AutoResourceCleanup:
|
68
|
+
Enabled: true
|
69
|
+
|
70
|
+
Style/CollectionMethods:
|
71
|
+
Enabled: true
|
72
|
+
|
73
|
+
Style/Documentation:
|
74
|
+
Enabled: false
|
75
|
+
|
76
|
+
Style/EmptyLiteral:
|
77
|
+
Enabled: false
|
78
|
+
|
79
|
+
Style/EmptyMethod:
|
80
|
+
EnforcedStyle: expanded
|
81
|
+
|
82
|
+
Style/FormatStringToken:
|
83
|
+
EnforcedStyle: template
|
84
|
+
|
85
|
+
Style/ImplicitRuntimeError:
|
86
|
+
Enabled: true
|
87
|
+
|
88
|
+
Style/MethodCalledOnDoEndBlock:
|
89
|
+
Enabled: true
|
90
|
+
|
91
|
+
Style/MethodDefParentheses:
|
92
|
+
EnforcedStyle: require_no_parentheses
|
93
|
+
|
94
|
+
Style/MissingElse:
|
95
|
+
Enabled: true
|
96
|
+
|
97
|
+
Style/NumericLiterals:
|
98
|
+
Enabled: false
|
99
|
+
|
100
|
+
Style/OptionHash:
|
101
|
+
Enabled: true
|
102
|
+
|
103
|
+
Style/PercentLiteralDelimiters:
|
104
|
+
PreferredDelimiters:
|
105
|
+
"%w": "[]"
|
106
|
+
"%W": "[]"
|
107
|
+
"%i": "[]"
|
108
|
+
"%I": "[]"
|
109
|
+
"%r": "()"
|
110
|
+
|
111
|
+
Style/ReturnNil:
|
112
|
+
Enabled: true
|
113
|
+
|
114
|
+
Style/SafeNavigation:
|
115
|
+
Enabled: false
|
116
|
+
|
117
|
+
Style/Send:
|
118
|
+
Enabled: true
|
119
|
+
|
120
|
+
Style/SignalException:
|
121
|
+
EnforcedStyle: semantic
|
122
|
+
|
123
|
+
Style/StringLiterals:
|
124
|
+
EnforcedStyle: double_quotes
|
125
|
+
|
126
|
+
Style/StringLiteralsInInterpolation:
|
127
|
+
EnforcedStyle: double_quotes
|
128
|
+
|
129
|
+
Style/StringMethods:
|
130
|
+
Enabled: true
|
131
|
+
|
132
|
+
Style/SymbolArray:
|
133
|
+
Enabled: true
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
2.5.1
|
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,269 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
integral-corrector (0.1.0)
|
5
|
+
|
6
|
+
GEM
|
7
|
+
remote: https://rubygems.org/
|
8
|
+
specs:
|
9
|
+
ast (2.4.2)
|
10
|
+
bigdecimal (3.1.5)
|
11
|
+
bundler-audit (0.9.1)
|
12
|
+
bundler (>= 1.2.0, < 3)
|
13
|
+
thor (~> 1.0)
|
14
|
+
byebug (11.1.3)
|
15
|
+
coderay (1.1.3)
|
16
|
+
cogger (0.14.0)
|
17
|
+
core (~> 0.1)
|
18
|
+
refinements (~> 11.0)
|
19
|
+
tone (~> 0.3)
|
20
|
+
zeitwerk (~> 2.6)
|
21
|
+
concurrent-ruby (1.2.2)
|
22
|
+
core (0.1.6)
|
23
|
+
diff-lcs (1.5.0)
|
24
|
+
dry-configurable (1.1.0)
|
25
|
+
dry-core (~> 1.0, < 2)
|
26
|
+
zeitwerk (~> 2.6)
|
27
|
+
dry-container (0.11.0)
|
28
|
+
concurrent-ruby (~> 1.0)
|
29
|
+
dry-core (1.0.1)
|
30
|
+
concurrent-ruby (~> 1.0)
|
31
|
+
zeitwerk (~> 2.6)
|
32
|
+
dry-inflector (1.0.0)
|
33
|
+
dry-initializer (3.1.1)
|
34
|
+
dry-logic (1.5.0)
|
35
|
+
concurrent-ruby (~> 1.0)
|
36
|
+
dry-core (~> 1.0, < 2)
|
37
|
+
zeitwerk (~> 2.6)
|
38
|
+
dry-monads (1.6.0)
|
39
|
+
concurrent-ruby (~> 1.0)
|
40
|
+
dry-core (~> 1.0, < 2)
|
41
|
+
zeitwerk (~> 2.6)
|
42
|
+
dry-schema (1.13.3)
|
43
|
+
concurrent-ruby (~> 1.0)
|
44
|
+
dry-configurable (~> 1.0, >= 1.0.1)
|
45
|
+
dry-core (~> 1.0, < 2)
|
46
|
+
dry-initializer (~> 3.0)
|
47
|
+
dry-logic (>= 1.4, < 2)
|
48
|
+
dry-types (>= 1.7, < 2)
|
49
|
+
zeitwerk (~> 2.6)
|
50
|
+
dry-types (1.7.2)
|
51
|
+
bigdecimal (~> 3.0)
|
52
|
+
concurrent-ruby (~> 1.0)
|
53
|
+
dry-core (~> 1.0)
|
54
|
+
dry-inflector (~> 1.0)
|
55
|
+
dry-logic (~> 1.4)
|
56
|
+
zeitwerk (~> 2.6)
|
57
|
+
etcher (0.5.1)
|
58
|
+
cogger (~> 0.12)
|
59
|
+
core (~> 0.1)
|
60
|
+
dry-monads (~> 1.6)
|
61
|
+
dry-types (~> 1.7)
|
62
|
+
refinements (~> 11.0)
|
63
|
+
versionaire (~> 12.1)
|
64
|
+
zeitwerk (~> 2.6)
|
65
|
+
ffi (1.16.3)
|
66
|
+
formatador (1.1.0)
|
67
|
+
gemsmith (20.7.0)
|
68
|
+
cogger (~> 0.12)
|
69
|
+
core (~> 0.1)
|
70
|
+
dry-container (~> 0.11)
|
71
|
+
dry-monads (~> 1.6)
|
72
|
+
dry-schema (~> 1.13)
|
73
|
+
etcher (~> 0.2)
|
74
|
+
infusible (~> 2.2)
|
75
|
+
milestoner (~> 16.0)
|
76
|
+
refinements (~> 11.0)
|
77
|
+
rubysmith (~> 5.9)
|
78
|
+
runcom (~> 10.0)
|
79
|
+
sod (~> 0.0)
|
80
|
+
spek (~> 2.0)
|
81
|
+
versionaire (~> 12.0)
|
82
|
+
zeitwerk (~> 2.6)
|
83
|
+
gitt (2.2.0)
|
84
|
+
core (~> 0.1)
|
85
|
+
dry-monads (~> 1.6)
|
86
|
+
refinements (~> 11.0)
|
87
|
+
zeitwerk (~> 2.6)
|
88
|
+
guard (2.18.1)
|
89
|
+
formatador (>= 0.2.4)
|
90
|
+
listen (>= 2.7, < 4.0)
|
91
|
+
lumberjack (>= 1.0.12, < 2.0)
|
92
|
+
nenv (~> 0.1)
|
93
|
+
notiffany (~> 0.0)
|
94
|
+
pry (>= 0.13.0)
|
95
|
+
shellany (~> 0.0)
|
96
|
+
thor (>= 0.18.1)
|
97
|
+
guard-compat (1.2.1)
|
98
|
+
guard-rspec (4.7.3)
|
99
|
+
guard (~> 2.1)
|
100
|
+
guard-compat (~> 1.1)
|
101
|
+
rspec (>= 2.99.0, < 4.0)
|
102
|
+
infusible (2.2.1)
|
103
|
+
marameters (~> 2.0)
|
104
|
+
zeitwerk (~> 2.6)
|
105
|
+
json (2.7.1)
|
106
|
+
language_server-protocol (3.17.0.3)
|
107
|
+
listen (3.8.0)
|
108
|
+
rb-fsevent (~> 0.10, >= 0.10.3)
|
109
|
+
rb-inotify (~> 0.9, >= 0.9.10)
|
110
|
+
lumberjack (1.2.10)
|
111
|
+
marameters (2.1.1)
|
112
|
+
refinements (~> 11.0)
|
113
|
+
zeitwerk (~> 2.6)
|
114
|
+
method_source (1.0.0)
|
115
|
+
milestoner (16.2.1)
|
116
|
+
cogger (~> 0.12)
|
117
|
+
dry-container (~> 0.11)
|
118
|
+
dry-monads (~> 1.6)
|
119
|
+
dry-schema (~> 1.13)
|
120
|
+
etcher (~> 0.2)
|
121
|
+
gitt (~> 2.0)
|
122
|
+
infusible (~> 2.2)
|
123
|
+
refinements (~> 11.0)
|
124
|
+
runcom (~> 10.0)
|
125
|
+
sod (~> 0.0)
|
126
|
+
spek (~> 2.0)
|
127
|
+
versionaire (~> 12.0)
|
128
|
+
zeitwerk (~> 2.6)
|
129
|
+
nenv (0.3.0)
|
130
|
+
notiffany (0.1.3)
|
131
|
+
nenv (~> 0.1)
|
132
|
+
shellany (~> 0.0)
|
133
|
+
parallel (1.24.0)
|
134
|
+
parser (3.2.2.4)
|
135
|
+
ast (~> 2.4.1)
|
136
|
+
racc
|
137
|
+
pragmater (13.2.1)
|
138
|
+
cogger (~> 0.12)
|
139
|
+
dry-container (~> 0.11)
|
140
|
+
dry-schema (~> 1.13)
|
141
|
+
etcher (~> 0.2)
|
142
|
+
infusible (~> 2.2)
|
143
|
+
refinements (~> 11.0)
|
144
|
+
runcom (~> 10.0)
|
145
|
+
sod (~> 0.0)
|
146
|
+
spek (~> 2.0)
|
147
|
+
zeitwerk (~> 2.6)
|
148
|
+
pry (0.14.2)
|
149
|
+
coderay (~> 1.1)
|
150
|
+
method_source (~> 1.0)
|
151
|
+
pry-byebug (3.10.1)
|
152
|
+
byebug (~> 11.0)
|
153
|
+
pry (>= 0.13, < 0.15)
|
154
|
+
racc (1.7.3)
|
155
|
+
rainbow (3.1.1)
|
156
|
+
rake (13.1.0)
|
157
|
+
rb-fsevent (0.11.2)
|
158
|
+
rb-inotify (0.10.1)
|
159
|
+
ffi (~> 1.0)
|
160
|
+
reek (6.2.0)
|
161
|
+
dry-schema (~> 1.13.0)
|
162
|
+
parser (~> 3.2.0)
|
163
|
+
rainbow (>= 2.0, < 4.0)
|
164
|
+
rexml (~> 3.1)
|
165
|
+
refinements (11.1.3)
|
166
|
+
regexp_parser (2.9.0)
|
167
|
+
rexml (3.2.6)
|
168
|
+
rspec (3.12.0)
|
169
|
+
rspec-core (~> 3.12.0)
|
170
|
+
rspec-expectations (~> 3.12.0)
|
171
|
+
rspec-mocks (~> 3.12.0)
|
172
|
+
rspec-core (3.12.2)
|
173
|
+
rspec-support (~> 3.12.0)
|
174
|
+
rspec-expectations (3.12.3)
|
175
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
176
|
+
rspec-support (~> 3.12.0)
|
177
|
+
rspec-mocks (3.12.6)
|
178
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
179
|
+
rspec-support (~> 3.12.0)
|
180
|
+
rspec-support (3.12.1)
|
181
|
+
rubocop (1.59.0)
|
182
|
+
json (~> 2.3)
|
183
|
+
language_server-protocol (>= 3.17.0)
|
184
|
+
parallel (~> 1.10)
|
185
|
+
parser (>= 3.2.2.4)
|
186
|
+
rainbow (>= 2.2.2, < 4.0)
|
187
|
+
regexp_parser (>= 1.8, < 3.0)
|
188
|
+
rexml (>= 3.2.5, < 4.0)
|
189
|
+
rubocop-ast (>= 1.30.0, < 2.0)
|
190
|
+
ruby-progressbar (~> 1.7)
|
191
|
+
unicode-display_width (>= 2.4.0, < 3.0)
|
192
|
+
rubocop-ast (1.30.0)
|
193
|
+
parser (>= 3.2.1.0)
|
194
|
+
ruby-progressbar (1.13.0)
|
195
|
+
rubysmith (5.9.0)
|
196
|
+
cogger (~> 0.12)
|
197
|
+
dry-container (~> 0.11)
|
198
|
+
dry-monads (~> 1.6)
|
199
|
+
dry-schema (~> 1.13)
|
200
|
+
etcher (~> 0.2)
|
201
|
+
gitt (~> 2.0)
|
202
|
+
infusible (~> 2.2)
|
203
|
+
milestoner (~> 16.0)
|
204
|
+
pragmater (~> 13.0)
|
205
|
+
refinements (~> 11.0)
|
206
|
+
rubocop (~> 1.55)
|
207
|
+
runcom (~> 10.0)
|
208
|
+
sod (~> 0.0)
|
209
|
+
spek (~> 2.0)
|
210
|
+
tocer (~> 16.0)
|
211
|
+
tone (~> 0.3)
|
212
|
+
zeitwerk (~> 2.6)
|
213
|
+
runcom (10.2.1)
|
214
|
+
refinements (~> 11.0)
|
215
|
+
xdg (~> 7.1)
|
216
|
+
zeitwerk (~> 2.6)
|
217
|
+
shellany (0.0.1)
|
218
|
+
sod (0.3.1)
|
219
|
+
cogger (~> 0.12)
|
220
|
+
dry-container (~> 0.11)
|
221
|
+
infusible (~> 2.2)
|
222
|
+
refinements (~> 11.0)
|
223
|
+
tone (~> 0.3)
|
224
|
+
zeitwerk (~> 2.6)
|
225
|
+
spek (2.1.1)
|
226
|
+
dry-monads (~> 1.6)
|
227
|
+
refinements (~> 11.0)
|
228
|
+
versionaire (~> 12.0)
|
229
|
+
zeitwerk (~> 2.6)
|
230
|
+
thor (1.3.0)
|
231
|
+
tocer (16.2.1)
|
232
|
+
cogger (~> 0.12)
|
233
|
+
core (~> 0.1)
|
234
|
+
dry-container (~> 0.11)
|
235
|
+
dry-schema (~> 1.13)
|
236
|
+
etcher (~> 0.2)
|
237
|
+
infusible (~> 2.2)
|
238
|
+
refinements (~> 11.0)
|
239
|
+
runcom (~> 10.0)
|
240
|
+
sod (~> 0.0)
|
241
|
+
spek (~> 2.0)
|
242
|
+
zeitwerk (~> 2.6)
|
243
|
+
tone (0.4.2)
|
244
|
+
refinements (~> 11.0)
|
245
|
+
zeitwerk (~> 2.6)
|
246
|
+
unicode-display_width (2.5.0)
|
247
|
+
versionaire (12.1.1)
|
248
|
+
refinements (~> 11.0)
|
249
|
+
xdg (7.1.3)
|
250
|
+
zeitwerk (2.6.12)
|
251
|
+
|
252
|
+
PLATFORMS
|
253
|
+
ruby
|
254
|
+
|
255
|
+
DEPENDENCIES
|
256
|
+
bundler
|
257
|
+
bundler-audit
|
258
|
+
gemsmith
|
259
|
+
guard-rspec
|
260
|
+
integral-corrector!
|
261
|
+
pry
|
262
|
+
pry-byebug
|
263
|
+
rake
|
264
|
+
reek
|
265
|
+
rspec
|
266
|
+
rubocop
|
267
|
+
|
268
|
+
BUNDLED WITH
|
269
|
+
2.5.4
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2018 Sergey Pedan
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
# Integral::Corrector
|
2
|
+
|
3
|
+
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/integral/corrector`. To experiment with that code, run `bin/console` for an interactive prompt.
|
4
|
+
|
5
|
+
TODO: Delete this and the text above, and describe your gem
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'integral-corrector'
|
13
|
+
```
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install integral-corrector
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
TODO: Write usage instructions here
|
26
|
+
|
27
|
+
## Development
|
28
|
+
|
29
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
30
|
+
|
31
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
32
|
+
|
33
|
+
## Contributing
|
34
|
+
|
35
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/integral-corrector.
|
36
|
+
|
37
|
+
## License
|
38
|
+
|
39
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
begin
|
4
|
+
require "bundler/audit/task"
|
5
|
+
require "bundler/gem_tasks"
|
6
|
+
require "reek/rake/task"
|
7
|
+
require "rspec/core/rake_task"
|
8
|
+
require "rubocop/rake_task"
|
9
|
+
|
10
|
+
RSpec::Core::RakeTask.new(:spec)
|
11
|
+
rescue LoadError => error
|
12
|
+
puts error.message
|
13
|
+
end
|
14
|
+
|
15
|
+
desc "Run code quality checks"
|
16
|
+
task code_quality: %i[bundle:audit git_cop reek rubocop]
|
17
|
+
|
18
|
+
task default: %i[code_quality spec]
|
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "integral/corrector"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require "integral/corrector/version"
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "integral-corrector"
|
8
|
+
spec.version = Integral::Corrector::VERSION
|
9
|
+
spec.authors = ["Sergey Pedan"]
|
10
|
+
spec.email = ["sergey.pedan@gmail.com"]
|
11
|
+
|
12
|
+
spec.summary = "Performs simple typographic corrections"
|
13
|
+
spec.description = "Performs simple typographic corrections: puts non-braking spaces after 1-letter particles etc."
|
14
|
+
spec.homepage = "https://github.com/sergeypedan/integral-corrector"
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
# Specify which files should be added to the gem when it is released.
|
18
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
19
|
+
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
20
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
21
|
+
end
|
22
|
+
spec.bindir = "exe"
|
23
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
24
|
+
spec.require_paths = ["lib"]
|
25
|
+
|
26
|
+
spec.required_ruby_version = ">= 2.5"
|
27
|
+
|
28
|
+
spec.add_development_dependency "bundler"
|
29
|
+
spec.add_development_dependency "bundler-audit"
|
30
|
+
spec.add_development_dependency "gemsmith"
|
31
|
+
spec.add_development_dependency "guard-rspec"
|
32
|
+
spec.add_development_dependency "pry"
|
33
|
+
spec.add_development_dependency "pry-byebug"
|
34
|
+
spec.add_development_dependency "rake"
|
35
|
+
spec.add_development_dependency "reek"
|
36
|
+
spec.add_development_dependency "rspec"
|
37
|
+
spec.add_development_dependency "rubocop"
|
38
|
+
end
|
@@ -0,0 +1,142 @@
|
|
1
|
+
# frozen_string_literal: false
|
2
|
+
|
3
|
+
require "integral/corrector/version"
|
4
|
+
require_relative "text_calculations"
|
5
|
+
|
6
|
+
module Integral
|
7
|
+
module Corrector
|
8
|
+
|
9
|
+
PREPOSITIONS = %w|а в во до ее её за и из их к мы на не но о об он от по с со то ты у я|
|
10
|
+
PRE_CHARACTERS = [" ", "(", "«"]
|
11
|
+
POST_CHARACTERS = [")", "»"]
|
12
|
+
MDASHES = ["-", "–"]
|
13
|
+
MONTH_NAMES = { generative: %W[января февраля марта апреля мая июня июля августа сентября октября ноября декабря] }
|
14
|
+
SPELLING_CORRECTIONS = [
|
15
|
+
["Все-таки", "Всё-таки"],
|
16
|
+
["все-таки", "всё-таки"],
|
17
|
+
["выдается", "выдаётся"],
|
18
|
+
[/\sдает/, " даёт"],
|
19
|
+
[/\sее\s/, " её "],
|
20
|
+
[/Ее\s/, "Её "],
|
21
|
+
[/\sеще\s/, " ещё "],
|
22
|
+
["Еще ", "Ещё "],
|
23
|
+
["зашел", "зашёл"],
|
24
|
+
[/\sзвезд /, " звёзд "],
|
25
|
+
[/\sзвезд\./, " звёзд."],
|
26
|
+
[/\sзвезд\,/, " звёзд,"],
|
27
|
+
["и т.д.", "и т.\u{00A0}д."],
|
28
|
+
["и т.п.", "и т.\u{00A0}п."],
|
29
|
+
[/\sнесет/, " несёт"],
|
30
|
+
["надежно", "надёжно"],
|
31
|
+
[/\sобъем/, " объём"],
|
32
|
+
["Объем", "Объём"],
|
33
|
+
[/\sпришлем/, " пришлём"],
|
34
|
+
["партнер", "партнёр"],
|
35
|
+
[/\sсвое\s/, " своё "],
|
36
|
+
["своем", "своём"],
|
37
|
+
["т.е.", "т.\u{00A0}е."],
|
38
|
+
[" нее ", " неё "],
|
39
|
+
["удаленн", "удалённ"],
|
40
|
+
["соц.сети", "— соцсети"],
|
41
|
+
["утонченн", "утончённ"],
|
42
|
+
["\sчье ", " чьё "],
|
43
|
+
["3-х мерн", "3-мерн"]
|
44
|
+
]
|
45
|
+
# Мое — Моё
|
46
|
+
|
47
|
+
module_function
|
48
|
+
|
49
|
+
|
50
|
+
def upcased_prepositions
|
51
|
+
PREPOSITIONS.map { |k| k.capitalize.to_s }
|
52
|
+
end
|
53
|
+
|
54
|
+
|
55
|
+
def all_prepositions
|
56
|
+
PREPOSITIONS + upcased_prepositions
|
57
|
+
end
|
58
|
+
|
59
|
+
|
60
|
+
def str_blank?(str)
|
61
|
+
str == "" || str.nil?
|
62
|
+
end
|
63
|
+
|
64
|
+
|
65
|
+
def fix_mdash(string)
|
66
|
+
return "" if str_blank?(string)
|
67
|
+
|
68
|
+
MDASHES.each do |dash|
|
69
|
+
string = string.gsub(" #{dash} ", " — ")
|
70
|
+
end
|
71
|
+
|
72
|
+
string
|
73
|
+
end
|
74
|
+
|
75
|
+
|
76
|
+
def fix_quotations(s)
|
77
|
+
return "" if str_blank?(s)
|
78
|
+
|
79
|
+
s.gsub(/^\"/, "«") # at the beginning of line
|
80
|
+
.gsub(/\"$/, "»") # at the end of line
|
81
|
+
.gsub(" \"", " «") # after a space
|
82
|
+
.gsub(/\"(?=[\.,!?])/, "»") # before a punctuation literal
|
83
|
+
.gsub(/(?<=[абвгдеёжзийклмнопрстуфхцчшщэюя])\"\s/i, "» ") # after an case-insentive cyrillic letter
|
84
|
+
end
|
85
|
+
|
86
|
+
|
87
|
+
def fix_units(string)
|
88
|
+
return "" if str_blank?(string)
|
89
|
+
|
90
|
+
string.gsub(" рублей", "\u{00A0}₽")
|
91
|
+
.gsub(" руб.", "\u{00A0}₽")
|
92
|
+
.gsub(" руб ", "\u{00A0}₽ ")
|
93
|
+
end
|
94
|
+
|
95
|
+
|
96
|
+
def fix_widow_prepositions(string)
|
97
|
+
return "" if str_blank?(string)
|
98
|
+
|
99
|
+
PRE_CHARACTERS.each do |pre|
|
100
|
+
all_prepositions.each do |k|
|
101
|
+
string = string.gsub "#{pre}#{k} ", "#{pre}#{k}\u{00A0}"
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
string
|
106
|
+
end
|
107
|
+
|
108
|
+
|
109
|
+
def fix_spelling(string)
|
110
|
+
return "" if str_blank?(string)
|
111
|
+
|
112
|
+
SPELLING_CORRECTIONS.each do |incorrect, correct|
|
113
|
+
string = string.gsub incorrect, correct
|
114
|
+
end
|
115
|
+
|
116
|
+
string
|
117
|
+
end
|
118
|
+
|
119
|
+
|
120
|
+
def fix_date_before_month(string)
|
121
|
+
return "" if str_blank?(string)
|
122
|
+
|
123
|
+
MONTH_NAMES[:generative].each do |month|
|
124
|
+
string = string.gsub /(?<=\d) (?=#{month})/, "\u{00A0}"
|
125
|
+
end
|
126
|
+
|
127
|
+
string
|
128
|
+
end
|
129
|
+
|
130
|
+
|
131
|
+
def proofread(string)
|
132
|
+
# string = fix_quotations(string)
|
133
|
+
string = fix_mdash(string)
|
134
|
+
string = fix_spelling(string)
|
135
|
+
string = fix_widow_prepositions(string)
|
136
|
+
string = fix_date_before_month(string)
|
137
|
+
string = fix_units(string)
|
138
|
+
string
|
139
|
+
end
|
140
|
+
|
141
|
+
end
|
142
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: false
|
2
|
+
|
3
|
+
module Integral
|
4
|
+
module TextCalculations
|
5
|
+
|
6
|
+
# need to replace with Integral::TextHelepr
|
7
|
+
def self.text_to_a4(text)
|
8
|
+
fail ArgumentError unless text.nil? || text.is_a?(String)
|
9
|
+
str = text.to_s
|
10
|
+
return 0 if str == ""
|
11
|
+
(str.size / 1800.0).round(1)
|
12
|
+
end
|
13
|
+
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
example_id | status | run_time |
|
2
|
+
--------------------------------------------------- | ------ | --------------- |
|
3
|
+
./spec/corrector/date_before_month_spec.rb[1:1:1:1] | passed | 0.00106 seconds |
|
4
|
+
./spec/corrector/date_before_month_spec.rb[1:1:2:1] | passed | 0.00064 seconds |
|
5
|
+
./spec/corrector/gem_version_spec.rb[1:1] | passed | 0.00118 seconds |
|
6
|
+
./spec/corrector/mdash_spec.rb[1:1:1] | passed | 0.00017 seconds |
|
7
|
+
./spec/corrector/mdash_spec.rb[1:1:2] | passed | 0.00012 seconds |
|
8
|
+
./spec/corrector/mdash_spec.rb[1:1:3] | passed | 0.00011 seconds |
|
9
|
+
./spec/corrector/quotes_spec.rb[1:1:1] | passed | 0.00018 seconds |
|
10
|
+
./spec/corrector/quotes_spec.rb[1:1:2] | passed | 0.00014 seconds |
|
11
|
+
./spec/corrector/quotes_spec.rb[1:1:3] | passed | 0.00018 seconds |
|
12
|
+
./spec/corrector/quotes_spec.rb[1:1:4] | passed | 0.0002 seconds |
|
13
|
+
./spec/corrector/quotes_spec.rb[1:1:5] | passed | 0.00017 seconds |
|
14
|
+
./spec/corrector/quotes_spec.rb[1:1:6] | passed | 0.00023 seconds |
|
15
|
+
./spec/corrector/spelling_spec.rb[1:1:1] | passed | 0.0002 seconds |
|
16
|
+
./spec/corrector/spelling_spec.rb[1:1:2] | passed | 0.00016 seconds |
|
17
|
+
./spec/corrector/spelling_spec.rb[1:1:3] | passed | 0.00017 seconds |
|
18
|
+
./spec/corrector/spelling_spec.rb[1:1:4] | passed | 0.00014 seconds |
|
19
|
+
./spec/corrector/spelling_spec.rb[1:1:5] | passed | 0.00014 seconds |
|
20
|
+
./spec/corrector/spelling_spec.rb[1:1:6] | passed | 0.00012 seconds |
|
21
|
+
./spec/corrector/spelling_spec.rb[1:1:7] | passed | 0.00022 seconds |
|
22
|
+
./spec/corrector/widows_spec.rb[1:1:1] | passed | 0.00043 seconds |
|
23
|
+
./spec/corrector/widows_spec.rb[1:1:2] | passed | 0.00038 seconds |
|
24
|
+
./spec/corrector/widows_spec.rb[1:1:3] | passed | 0.00045 seconds |
|
metadata
ADDED
@@ -0,0 +1,202 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: integral-corrector
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Sergey Pedan
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2024-01-10 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler-audit
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: gemsmith
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: guard-rspec
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: pry
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: pry-byebug
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: rake
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: reek
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: rspec
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ">="
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0'
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: rubocop
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - ">="
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: '0'
|
146
|
+
type: :development
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - ">="
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '0'
|
153
|
+
description: 'Performs simple typographic corrections: puts non-braking spaces after
|
154
|
+
1-letter particles etc.'
|
155
|
+
email:
|
156
|
+
- sergey.pedan@gmail.com
|
157
|
+
executables: []
|
158
|
+
extensions: []
|
159
|
+
extra_rdoc_files: []
|
160
|
+
files:
|
161
|
+
- ".gitignore"
|
162
|
+
- ".reek.yml"
|
163
|
+
- ".rspec"
|
164
|
+
- ".rubocop.yml"
|
165
|
+
- ".ruby-version"
|
166
|
+
- ".travis.yml"
|
167
|
+
- Gemfile
|
168
|
+
- Gemfile.lock
|
169
|
+
- LICENSE.txt
|
170
|
+
- README.md
|
171
|
+
- Rakefile
|
172
|
+
- bin/console
|
173
|
+
- bin/setup
|
174
|
+
- integral-corrector.gemspec
|
175
|
+
- lib/integral/corrector.rb
|
176
|
+
- lib/integral/corrector/version.rb
|
177
|
+
- lib/integral/text_calculations.rb
|
178
|
+
- temp/rspec-status.txt
|
179
|
+
homepage: https://github.com/sergeypedan/integral-corrector
|
180
|
+
licenses:
|
181
|
+
- MIT
|
182
|
+
metadata: {}
|
183
|
+
post_install_message:
|
184
|
+
rdoc_options: []
|
185
|
+
require_paths:
|
186
|
+
- lib
|
187
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
188
|
+
requirements:
|
189
|
+
- - ">="
|
190
|
+
- !ruby/object:Gem::Version
|
191
|
+
version: '2.5'
|
192
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
193
|
+
requirements:
|
194
|
+
- - ">="
|
195
|
+
- !ruby/object:Gem::Version
|
196
|
+
version: '0'
|
197
|
+
requirements: []
|
198
|
+
rubygems_version: 3.5.4
|
199
|
+
signing_key:
|
200
|
+
specification_version: 4
|
201
|
+
summary: Performs simple typographic corrections
|
202
|
+
test_files: []
|