accent_to_ascii 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6e1b3456efd1dbc527f07aa580e425665fac2a8f
4
- data.tar.gz: 85a928759cfc7db9fe38a9924d81768c5761c26d
3
+ metadata.gz: 7037225458d3feeac317382b8d75c6ab98c70b96
4
+ data.tar.gz: 6ad3557c3c606991a04ad5fa1cae0cad1924de3c
5
5
  SHA512:
6
- metadata.gz: 6f14c1846d46302bc2e56de59323dd757deb988c9766ab574ee3da61f0179426c5430a4ffc9879f3d7eca85909f3317e4bece264b108b8bd8c997f92d1954dc5
7
- data.tar.gz: 80d203f099f8edf8526356c966237dad9757c546fd31f40f6ba5453b2ad9736e74e36e311a9e12f04685f01274a860dc77a11b1335d052f297c813fda773d26d
6
+ metadata.gz: 058126d0b96ec1ff18b7ef99a978283cb7f03c9458bcab91b0b0382f05600d07278ae3f651e59fbace95080fc6940368bfecd3ebc7884037f8068eeeca92cb04
7
+ data.tar.gz: a844921017acd245f09d8e4206f8535f57b5d66b8be8f83aa9f5ddea75bbb7c4da6f60255a0e1712baa75e63dd09f2df474c1dc8106506298c00c4c07dbe1e21
@@ -1,7 +1,6 @@
1
1
  require "accent_to_ascii/version"
2
2
 
3
3
  module AccentToAscii
4
- # Your code goes here...
5
4
  ACCENTS_MAPPING = {
6
5
  'E' => [200,201,202,203],
7
6
  'e' => [232,233,234,235,7869],
@@ -25,27 +24,25 @@ module AccentToAscii
25
24
  'oe' => [189]
26
25
  }
27
26
 
28
- class AccentToAscii
29
- def self.accent_to_ascii(string)
30
- string.tap do |s|
31
- ACCENTS_MAPPING.each { |letter, accents| replace(s, letter, accents) }
32
- end
27
+ def self.accent_to_ascii(string)
28
+ string.tap do |s|
29
+ ACCENTS_MAPPING.each { |letter, accents| replace(s, letter, accents) }
33
30
  end
31
+ end
34
32
 
35
- private
33
+ private
36
34
 
37
- def self.replace(string, letter, accents)
38
- packed = accents.pack('U*')
39
- regex = Regexp.new("[#{packed}]", nil)
40
- string.gsub!(regex, letter)
41
- end
35
+ def self.replace(string, letter, accents)
36
+ packed = accents.pack('U*')
37
+ regex = Regexp.new("[#{packed}]", nil)
38
+ string.gsub!(regex, letter)
42
39
  end
43
40
 
44
41
  end
45
42
 
46
43
  class String
47
44
  def accent_to_ascii(string = String.new(self))
48
- AccentToAscii::AccentToAscii.accent_to_ascii(string)
45
+ AccentToAscii.accent_to_ascii(string)
49
46
  end
50
47
 
51
48
  def accent_to_ascii!
@@ -1,3 +1,3 @@
1
1
  module AccentToAscii
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: accent_to_ascii
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - uniEagle
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-11-09 00:00:00.000000000 Z
11
+ date: 2016-11-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler