text_alignment 0.12.7 → 0.12.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 +4 -4
- data/lib/text_alignment/char_mapping.rb +17 -5
- data/lib/text_alignment/version.rb +1 -1
- 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: 528dd8cf88da73d13e8933b69ce2cfb27a1cbd245392e072c53c2c02bd1b57c4
|
4
|
+
data.tar.gz: b74d808fe3412f704e7770ac0ac50a645ef75e9c8667f715324f7769f3bf151f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 461745ed09343a23ab2a5ca008cc2625ec7679573c57bbb1e70e1f76cd2d51478ed2bcbb47197aee76255de3404897138ec569cfb93149690b974f26d203594d
|
7
|
+
data.tar.gz: 937f951a7e84bf065ab7ad4818d7d9731f365c16abadf165cb9daca27eefde83f0d695b33b60b5d54a3af97ea3b6c963b95183ff25e19794fa005474602ee6e9
|
@@ -202,7 +202,7 @@ class TextAlignment::CharMapping
|
|
202
202
|
|
203
203
|
# To execute the long letter mapping
|
204
204
|
char_mapping.each do |one, long|
|
205
|
-
next unless text
|
205
|
+
next unless text.include?(one)
|
206
206
|
text.gsub!(one * long.length, one) if long.length > 1
|
207
207
|
end
|
208
208
|
|
@@ -215,17 +215,29 @@ class TextAlignment::CharMapping
|
|
215
215
|
# To get squeeze positions of whitespaces to one
|
216
216
|
def get_positions_squeeze_ws_1(text)
|
217
217
|
rpositions = []
|
218
|
-
|
219
|
-
|
220
|
-
|
218
|
+
scanner = StringScanner.new(text)
|
219
|
+
|
220
|
+
while scanner.scan_until(/\s{2,}/)
|
221
|
+
len = scanner.matched_size
|
222
|
+
loc = scanner.pos - len
|
221
223
|
rpositions << [loc, len, 1]
|
222
224
|
end
|
225
|
+
|
223
226
|
rpositions
|
224
227
|
end
|
225
228
|
|
226
229
|
# To get squeeze positions of whitespaces to zero
|
227
230
|
def get_positions_squeeze_ws_0(text)
|
228
|
-
|
231
|
+
rpositions = []
|
232
|
+
scanner = StringScanner.new(text)
|
233
|
+
|
234
|
+
while scanner.scan(/\s+/)
|
235
|
+
len = scanner.matched_size
|
236
|
+
start = scanner.pos - len
|
237
|
+
rpositions << [start, len, 0]
|
238
|
+
end
|
239
|
+
|
240
|
+
rpositions
|
229
241
|
end
|
230
242
|
|
231
243
|
def squeeze_ws_1!(text)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: text_alignment
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.12.
|
4
|
+
version: 0.12.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jin-Dong Kim
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-05-
|
11
|
+
date: 2025-05-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ruby-dictionary
|