ascii_folding 0.1.0
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 +7 -0
- data/.rspec +3 -0
- data/.rubocop.yml +13 -0
- data/README.md +25 -0
- data/Rakefile +12 -0
- data/ascii_folding.gemspec +29 -0
- data/lib/ascii_folding/approximations.rb +1248 -0
- data/lib/ascii_folding/version.rb +5 -0
- data/lib/ascii_folding.rb +12 -0
- data/sig/ascii_folding.rbs +6 -0
- metadata +54 -0
@@ -0,0 +1,12 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "ascii_folding/version"
|
4
|
+
require_relative "ascii_folding/approximations"
|
5
|
+
|
6
|
+
module AsciiFolding
|
7
|
+
def self.fold(string, replacement: "?")
|
8
|
+
string.gsub(/[^\x00-\x7f]/u) do |char|
|
9
|
+
AsciiFolding::APPROXIMATIONS[char] || replacement
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
metadata
ADDED
@@ -0,0 +1,54 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: ascii_folding
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Donatas Povilaitis
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2023-12-04 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: Folds non-ASCII characters into approximate ASCII equivalents, using
|
14
|
+
character mapping tables that are the same as those used by Lucene's ASCIIFoldingFilter.
|
15
|
+
email:
|
16
|
+
- ddonatasjar@gmail.com
|
17
|
+
executables: []
|
18
|
+
extensions: []
|
19
|
+
extra_rdoc_files: []
|
20
|
+
files:
|
21
|
+
- ".rspec"
|
22
|
+
- ".rubocop.yml"
|
23
|
+
- README.md
|
24
|
+
- Rakefile
|
25
|
+
- ascii_folding.gemspec
|
26
|
+
- lib/ascii_folding.rb
|
27
|
+
- lib/ascii_folding/approximations.rb
|
28
|
+
- lib/ascii_folding/version.rb
|
29
|
+
- sig/ascii_folding.rbs
|
30
|
+
homepage:
|
31
|
+
licenses: []
|
32
|
+
metadata:
|
33
|
+
homepage_uri: https://github.com/donny741/ascii_folding
|
34
|
+
source_code_uri: https://github.com/donny741/ascii_folding
|
35
|
+
post_install_message:
|
36
|
+
rdoc_options: []
|
37
|
+
require_paths:
|
38
|
+
- lib
|
39
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
40
|
+
requirements:
|
41
|
+
- - ">="
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: 2.6.0
|
44
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
45
|
+
requirements:
|
46
|
+
- - ">="
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: '0'
|
49
|
+
requirements: []
|
50
|
+
rubygems_version: 3.3.26
|
51
|
+
signing_key:
|
52
|
+
specification_version: 4
|
53
|
+
summary: Ruby port of Lucene's ASCIIFoldingFilter.
|
54
|
+
test_files: []
|