ascii_folding 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- 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
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: e6e3df775278ff0540cd14e7b60b07851509733f52d509fd20afeb87e124e82d
|
4
|
+
data.tar.gz: d4182fd9bcf18bc5e4878cbd9a9847ac42f20062eeb093eafcf2706fbc973c30
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 531212795ca301e468f038aa21cf04e80635f844002b5e17e361b122dbf5f406969cc636cd8b214887baefc8a2a4d1cd81cd0cca45a275e85deca3e142de0905
|
7
|
+
data.tar.gz: ab2ec1b83517cd81ecfda38736d556a02039febc1ec7f26c01ad94f08578471f0252c9426ebb4498c4f1a973c4816f3ebaf3d3752dfb8a9ecf139813c1f5194a
|
data/.rspec
ADDED
data/.rubocop.yml
ADDED
data/README.md
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
# AsciiFolding
|
2
|
+
|
3
|
+
UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_RELEASE_TO_RUBYGEMS_ORG is a Ruby gem providing functionality for ASCII folding. This gem converts non-ASCII characters in a string to their ASCII approximations based on predefined mappings, making it useful for applications requiring standard ASCII characters, such as slug generation or text normalization.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Install the gem and add to the application's Gemfile by executing:
|
8
|
+
|
9
|
+
$ bundle add UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_RELEASE_TO_RUBYGEMS_ORG
|
10
|
+
|
11
|
+
If bundler is not being used to manage dependencies, install the gem by executing:
|
12
|
+
|
13
|
+
$ gem install UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_RELEASE_TO_RUBYGEMS_ORG
|
14
|
+
|
15
|
+
## Usage
|
16
|
+
|
17
|
+
To use the ASCII folding functionality, require the gem in your Ruby script and call the fold method with the string you want to process:
|
18
|
+
|
19
|
+
```ruby
|
20
|
+
require 'UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_RELEASE_TO_RUBYGEMS_ORG'
|
21
|
+
|
22
|
+
input_string = "Your string with special characters like À, É, etc."
|
23
|
+
ascii_folded_string = AsciiFolding.fold(input_string)
|
24
|
+
puts ascii_folded_string
|
25
|
+
```
|
data/Rakefile
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "lib/ascii_folding/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = "ascii_folding"
|
7
|
+
spec.version = AsciiFolding::VERSION
|
8
|
+
spec.authors = ["Donatas Povilaitis"]
|
9
|
+
spec.email = ["ddonatasjar@gmail.com"]
|
10
|
+
|
11
|
+
spec.summary = "Ruby port of Lucene's ASCIIFoldingFilter."
|
12
|
+
spec.description = "Folds non-ASCII characters into approximate ASCII equivalents, using character " \
|
13
|
+
"mapping tables that are the same as those used by Lucene's ASCIIFoldingFilter."
|
14
|
+
spec.required_ruby_version = ">= 2.6.0"
|
15
|
+
|
16
|
+
spec.metadata["homepage_uri"] = "https://github.com/donny741/ascii_folding"
|
17
|
+
spec.metadata["source_code_uri"] = "https://github.com/donny741/ascii_folding"
|
18
|
+
|
19
|
+
# Specify which files should be added to the gem when it is released.
|
20
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
21
|
+
spec.files = Dir.chdir(__dir__) do
|
22
|
+
`git ls-files -z`.split("\x0").reject do |f|
|
23
|
+
(File.expand_path(f) == __FILE__) ||
|
24
|
+
f.start_with?(*%w[bin/ test/ spec/ features/ .git .circleci appveyor Gemfile])
|
25
|
+
end
|
26
|
+
end
|
27
|
+
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
|
28
|
+
spec.require_paths = ["lib"]
|
29
|
+
end
|