latin_to_normal_character 0.0.1

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 920697580863dd4176595da6c2fcb9200e0212c05a97a4244f9ab624165397ef
4
+ data.tar.gz: cdd2c97cc2c740889c0893d5635ed7a4c1a2297af9189d64904abc529531cf1d
5
+ SHA512:
6
+ metadata.gz: 044f0af746bc66f44cd93fb85d7287fdf61a1d7da0dc6534e57eeec310c1a0c27ecf5c991fb0721d983d499a31db6f508b2812df2ee43624782c3cc9639740cf
7
+ data.tar.gz: b79de31dd0e077c0909239a209f502a4f7205d6c2ec5d0f49a3548f956030637e7a522ede4dda9c58db6c0b30be7727911267d27af70203882e1102131f22685
@@ -0,0 +1,38 @@
1
+
2
+ class LatinToNormalCharacter
3
+ def self.call(latin_string)
4
+ if latin_string.match?(/[ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝàáâãäåæçèéêëìíîïðñòóôõöøùúûüý]/)
5
+ latin_string.split(//).each do |str|
6
+ LATIN.each do |index, item|
7
+ if item.include? str
8
+ latin_string.gsub! str, "#{index}"
9
+ end
10
+ end
11
+ end
12
+ end
13
+
14
+ return latin_string
15
+ end
16
+ end
17
+
18
+ # Constant variable.
19
+ LATIN = {
20
+ A: ['À', 'Á', 'Â', 'Ã', 'Ä', 'Å', 'Æ'],
21
+ a: ['à', 'á', 'â', 'ã', 'ä', 'å', 'æ'],
22
+ C: ['Ç'],
23
+ c: ['ç'],
24
+ E: ['È', 'É', 'Ê', 'Ë'],
25
+ e: ['è', 'é', 'ê', 'ë'],
26
+ I: ['Ì', 'Í', 'Î', 'Ï'],
27
+ i: ['ì', 'í', 'î', 'ï'],
28
+ D: ['Ð'],
29
+ d: ['ð'],
30
+ N: ['Ñ'],
31
+ n: ['ñ'],
32
+ O: ['Ò', 'Ó', 'Ô', 'Õ', 'Ö', 'Ø'],
33
+ o: ['ò', 'ó', 'ô', 'õ', 'ö' 'ø'],
34
+ U: ['Ù', 'Ú', 'Û', 'Ü'],
35
+ u: ['ù', 'ú', 'û', 'ü'],
36
+ Y: ['Ý'],
37
+ y: ['ý'],
38
+ }
metadata ADDED
@@ -0,0 +1,44 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: latin_to_normal_character
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Mark Gerald Cabatingan
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2020-03-19 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: 'This will replace the latin character inside a string to correspond
14
+ normal character example: à to a.'
15
+ email: markgeraldcabatingan@gmail.com
16
+ executables: []
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - lib/latin_to_normal_character.rb
21
+ homepage:
22
+ licenses: []
23
+ metadata:
24
+ source_code_uri: https://github.com/mgc-robot/latin-to-normal-character
25
+ post_install_message:
26
+ rdoc_options: []
27
+ require_paths:
28
+ - lib
29
+ required_ruby_version: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ required_rubygems_version: !ruby/object:Gem::Requirement
35
+ requirements:
36
+ - - ">="
37
+ - !ruby/object:Gem::Version
38
+ version: '0'
39
+ requirements: []
40
+ rubygems_version: 3.0.6
41
+ signing_key:
42
+ specification_version: 4
43
+ summary: convert latin character to normal character
44
+ test_files: []