sixarm_ruby_unaccent 1.1.2 → 1.2.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
- SHA1:
3
- metadata.gz: 94288a41800a430481e25b19fe90d6f151309845
4
- data.tar.gz: 42c775a295eafc7103c09ec01c69e8d02edff276
2
+ SHA256:
3
+ metadata.gz: 4a845d579ec37a17e9259739ed092753f18623f315aeb990afd756e19f1ee047
4
+ data.tar.gz: c299dff39ce0a1ece6b1c57404bf2e083c0b4e5dabc414992b4186111f4f8397
5
5
  SHA512:
6
- metadata.gz: bcae3dffee353e9b56e4741bf69b52b65ddd50dc4fc9c61b6557fabbba318ca4e4157a25c210f158ad75eca78014dba6d0ec49625ac793dc9bde7aebe6f2078f
7
- data.tar.gz: 27a9c7becaf728b766217280db58b2a0188cff1e8745aa7a655217d06c26549431dd2d7e46eece4b2e4a4ac91db3dc46803a6ca018e60659448af76caced8247
6
+ metadata.gz: 04f34f0e0dd1c6921584be3e68be4f6a17fb8ebf7a3bf4f2c86c62665d079b0a9f124c6775c2fb5c439f4b5ef4bc78274d6be8bab1274507440400cd417c92fb
7
+ data.tar.gz: 5c017d0ab115a3456f04c80f66237b298aceba6d17de31d5a8ada0c53ea1321184deea0132ae4ed2363ff631688bf5527da143fb78da91182d9c71bad4ae80d5
checksums.yaml.gz.sig CHANGED
Binary file
data/Rakefile CHANGED
@@ -2,45 +2,9 @@
2
2
  require "rake"
3
3
  require "rake/testtask"
4
4
 
5
+ task :default => [:test]
6
+
5
7
  Rake::TestTask.new(:test) do |t|
6
8
  t.libs.push("lib", "test")
7
9
  t.pattern = "test/**/*.rb"
8
10
  end
9
- task :default => [:test]
10
- task :default => [:test]
11
- task :default => [:test]
12
- task :default => [:test]
13
- task :default => [:test]
14
- task :default => [:test]
15
- task :default => [:test]
16
- task :default => [:test]
17
- task :default => [:test]
18
- task :default => [:test]
19
- task :default => [:test]
20
- task :default => [:test]
21
- task :default => [:test]
22
- task :default => [:test]
23
- task :default => [:test]
24
- task :default => [:test]
25
- task :default => [:test]
26
- task :default => [:test]
27
- task :default => [:test]
28
- task :default => [:test]
29
- task :default => [:test]
30
- task :default => [:test]
31
- task :default => [:test]
32
- task :default => [:test]
33
- task :default => [:test]
34
- task :default => [:test]
35
- task :default => [:test]
36
- task :default => [:test]
37
- task :default => [:test]
38
- task :default => [:test]
39
- task :default => [:test]
40
- task :default => [:test]
41
- task :default => [:test]
42
- task :default => [:test]
43
- task :default => [:test]
44
- task :default => [:test]
45
- task :default => [:test]
46
- task :default => [:test]
@@ -14,9 +14,46 @@ class String
14
14
  # @return [String] a string that has no accents
15
15
 
16
16
  def unaccent
17
- s = ""
18
- each_char{|c| s << (ACCENTMAP[c] || c)}
19
- return s
17
+ unaccent_via_scan
18
+ end
19
+
20
+ # Replace a string's accented characters with unaccented characters,
21
+ # by using string `#scan` to iterate on characters.
22
+ #
23
+ # @example
24
+ # s = "Å Ç ß"
25
+ # s.unaccent_via_scan = > "AA C ss"
26
+ #
27
+ # @return [String] a string that has no accents
28
+
29
+ def unaccent_via_scan
30
+ result=""; scan(/./){|c| result += (ACCENTMAP[c] || c) }; result
31
+ end
32
+
33
+ # Replace a string's accented characters with unaccented characters,
34
+ # by using string `#each_char` to iterate on characters.
35
+ #
36
+ # @example
37
+ # s = "Å Ç ß"
38
+ # s.unaccent_via_each_char = > "AA C ss"
39
+ #
40
+ # @return [String] a string that has no accents
41
+
42
+ def unaccent_via_each_char
43
+ result=""; each_char{|c| result += (ACCENTMAP[c] || c) }; result
44
+ end
45
+
46
+ # Replace a string's accented characters with unaccented characters,
47
+ # by using string `#split` and `#map` to iterate on characters.
48
+ #
49
+ # @example
50
+ # s = "Å Ç ß"
51
+ # s.unaccent_via_split_map = > "AA C ss"
52
+ #
53
+ # @return [String] a string that has no accents
54
+
55
+ def unaccent_via_split_map
56
+ split(//u).map{|c| ACCENTMAP[c] || c }.join("")
20
57
  end
21
58
 
22
59
  ACCENTMAP = {
@@ -6,25 +6,97 @@ describe String do
6
6
  describe "#unaccent" do
7
7
 
8
8
  it "with plain" do
9
- "abc".unaccent.must_equal "abc"
9
+ _("abc".unaccent).must_equal "abc"
10
10
  end
11
11
 
12
12
  it "with angstrom" do
13
- "Å".unaccent.must_equal "A"
13
+ _("Å".unaccent).must_equal "A"
14
14
  end
15
15
 
16
16
  it "with double letter" do
17
- "Æ".unaccent.must_equal "AE"
17
+ _("Æ".unaccent).must_equal "AE"
18
18
  end
19
19
 
20
20
  it "with french" do
21
- "déjà vu".unaccent.must_equal "deja vu"
21
+ _("déjà vu".unaccent).must_equal "deja vu"
22
22
  end
23
23
 
24
24
  it "with greek" do
25
- "νέα".unaccent.must_equal "νεα"
25
+ _("νέα".unaccent).must_equal "νεα"
26
26
  end
27
27
 
28
28
  end
29
29
 
30
+ describe "#unaccent_via_scan" do
31
+
32
+ it "with plain" do
33
+ _("abc".unaccent).must_equal "abc"
34
+ end
35
+
36
+ it "with angstrom" do
37
+ _("Å".unaccent).must_equal "A"
38
+ end
39
+
40
+ it "with double letter" do
41
+ _("Æ".unaccent).must_equal "AE"
42
+ end
43
+
44
+ it "with french" do
45
+ _("déjà vu".unaccent).must_equal "deja vu"
46
+ end
47
+
48
+ it "with greek" do
49
+ _("νέα".unaccent).must_equal "νεα"
50
+ end
51
+
52
+ end
53
+
54
+ describe "#unaccent_via_each_char" do
55
+
56
+ it "with plain" do
57
+ _("abc".unaccent).must_equal "abc"
58
+ end
59
+
60
+ it "with angstrom" do
61
+ _("Å".unaccent).must_equal "A"
62
+ end
63
+
64
+ it "with double letter" do
65
+ _("Æ".unaccent).must_equal "AE"
66
+ end
67
+
68
+ it "with french" do
69
+ _("déjà vu".unaccent).must_equal "deja vu"
70
+ end
71
+
72
+ it "with greek" do
73
+ _("νέα".unaccent).must_equal "νεα"
74
+ end
75
+
76
+ end
77
+
78
+ describe "#unaccent_via_split_map" do
79
+
80
+ it "with plain" do
81
+ _("abc".unaccent).must_equal "abc"
82
+ end
83
+
84
+ it "with angstrom" do
85
+ _("Å".unaccent).must_equal "A"
86
+ end
87
+
88
+ it "with double letter" do
89
+ _("Æ".unaccent).must_equal "AE"
90
+ end
91
+
92
+ it "with french" do
93
+ _("déjà vu".unaccent).must_equal "deja vu"
94
+ end
95
+
96
+ it "with greek" do
97
+ _("νέα".unaccent).must_equal "νεα"
98
+ end
99
+
100
+ end
101
+
30
102
  end
@@ -1,11 +1,9 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  require "minitest/autorun"
3
- require "coveralls"
3
+ #require "minitest/benchmark" if ENV["BENCH"]
4
4
  require "simplecov"
5
- Coveralls.wear!
6
- SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
5
+ SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter.new([
7
6
  SimpleCov::Formatter::HTMLFormatter,
8
- Coveralls::SimpleCov::Formatter
9
- ]
7
+ ])
10
8
  SimpleCov.start
11
9
  require "sixarm_ruby_unaccent"
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,50 +1,41 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sixarm_ruby_unaccent
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.2
4
+ version: 1.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - SixArm
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain:
11
11
  - |
12
12
  -----BEGIN CERTIFICATE-----
13
- MIIGCTCCA/GgAwIBAgIJAK3igyLv2hNNMA0GCSqGSIb3DQEBBQUAMGAxCzAJBgNV
14
- BAYTAlVTMRMwEQYDVQQIEwpDYWxpZm9ybmlhMRYwFAYDVQQHEw1TYW4gRnJhbmNp
15
- c2NvMQ8wDQYDVQQKEwZTaXhBcm0xEzARBgNVBAMTCnNpeGFybS5jb20wHhcNMTUw
16
- MzE0MjA0MTE5WhcNMTcxMjA4MjA0MTE5WjBgMQswCQYDVQQGEwJVUzETMBEGA1UE
17
- CBMKQ2FsaWZvcm5pYTEWMBQGA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Kl1cIkVS2k
32
+ 8oj6PNP/lK+P2TFa0hsMOeQNowTfKRacm0hn/eaYIwLbx3JFJ+lt5w9YAdCta+E5
33
+ fr7EEQwzNmMcy7JldkX/WgmeEQCzqlRy4l+jl2ZHxYJLXAiYkkzsWJQsQ4hqpVnx
34
+ 1psx5VLih5iWoiEuthGA7x5i0HEgBWkI1BLyIlC2YsXpJ+YAWDowK+On40R07qOn
35
+ h3dRMKiZUNmDeYWbQZE/IU/yO1utU5j/g73CBa+J51KcypcvK0bdlBb8KQfrYbpt
36
+ Wpzwx/JmdyV61orp2CQUQxMmEOIh9d8OMAdjOw6ooaw=
46
37
  -----END CERTIFICATE-----
47
- date: 2017-06-05 00:00:00.000000000 Z
38
+ date: 2023-05-23 00:00:00.000000000 Z
48
39
  dependencies:
49
40
  - !ruby/object:Gem::Dependency
50
41
  name: minitest
@@ -52,7 +43,7 @@ dependencies:
52
43
  requirements:
53
44
  - - ">="
54
45
  - !ruby/object:Gem::Version
55
- version: 5.7.0
46
+ version: '5.12'
56
47
  - - "<"
57
48
  - !ruby/object:Gem::Version
58
49
  version: '6'
@@ -62,57 +53,57 @@ dependencies:
62
53
  requirements:
63
54
  - - ">="
64
55
  - !ruby/object:Gem::Version
65
- version: 5.7.0
56
+ version: '5.12'
66
57
  - - "<"
67
58
  - !ruby/object:Gem::Version
68
59
  version: '6'
69
60
  - !ruby/object:Gem::Dependency
70
- name: rake
61
+ name: sixarm_ruby_minitest_extensions
71
62
  requirement: !ruby/object:Gem::Requirement
72
63
  requirements:
73
- - - ">"
64
+ - - ">="
74
65
  - !ruby/object:Gem::Version
75
- version: 10.4.2
66
+ version: 1.0.8
76
67
  - - "<"
77
68
  - !ruby/object:Gem::Version
78
- version: '11'
69
+ version: '2'
79
70
  type: :development
80
71
  prerelease: false
81
72
  version_requirements: !ruby/object:Gem::Requirement
82
73
  requirements:
83
- - - ">"
74
+ - - ">="
84
75
  - !ruby/object:Gem::Version
85
- version: 10.4.2
76
+ version: 1.0.8
86
77
  - - "<"
87
78
  - !ruby/object:Gem::Version
88
- version: '11'
79
+ version: '2'
89
80
  - !ruby/object:Gem::Dependency
90
- name: simplecov
81
+ name: rake
91
82
  requirement: !ruby/object:Gem::Requirement
92
83
  requirements:
93
84
  - - ">="
94
85
  - !ruby/object:Gem::Version
95
- version: 0.10.0
86
+ version: 12.3.3
96
87
  - - "<"
97
88
  - !ruby/object:Gem::Version
98
- version: '2'
89
+ version: '13'
99
90
  type: :development
100
91
  prerelease: false
101
92
  version_requirements: !ruby/object:Gem::Requirement
102
93
  requirements:
103
94
  - - ">="
104
95
  - !ruby/object:Gem::Version
105
- version: 0.10.0
96
+ version: 12.3.3
106
97
  - - "<"
107
98
  - !ruby/object:Gem::Version
108
- version: '2'
99
+ version: '13'
109
100
  - !ruby/object:Gem::Dependency
110
- name: coveralls
101
+ name: simplecov
111
102
  requirement: !ruby/object:Gem::Requirement
112
103
  requirements:
113
104
  - - ">="
114
105
  - !ruby/object:Gem::Version
115
- version: 0.8.2
106
+ version: 0.18.0
116
107
  - - "<"
117
108
  - !ruby/object:Gem::Version
118
109
  version: '2'
@@ -122,7 +113,7 @@ dependencies:
122
113
  requirements:
123
114
  - - ">="
124
115
  - !ruby/object:Gem::Version
125
- version: 0.8.2
116
+ version: 0.18.0
126
117
  - - "<"
127
118
  - !ruby/object:Gem::Version
128
119
  version: '2'
@@ -144,13 +135,15 @@ licenses:
144
135
  - BSD-3-Clause
145
136
  - CC-BY-NC-SA-4.0
146
137
  - AGPL-3.0
138
+ - EPL-1.0
139
+ - GPL-2.0
147
140
  - GPL-3.0
148
141
  - LGPL-3.0
149
142
  - MIT
150
143
  - MPL-2.0
151
144
  - Ruby
152
145
  metadata: {}
153
- post_install_message:
146
+ post_install_message:
154
147
  rdoc_options: []
155
148
  require_paths:
156
149
  - lib
@@ -158,16 +151,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
158
151
  requirements:
159
152
  - - ">="
160
153
  - !ruby/object:Gem::Version
161
- version: '0'
154
+ version: '2.2'
162
155
  required_rubygems_version: !ruby/object:Gem::Requirement
163
156
  requirements:
164
157
  - - ">="
165
158
  - !ruby/object:Gem::Version
166
159
  version: '0'
167
160
  requirements: []
168
- rubyforge_project:
169
- rubygems_version: 2.6.12
170
- signing_key:
161
+ rubygems_version: 3.3.26
162
+ signing_key:
171
163
  specification_version: 4
172
164
  summary: SixArm.com → Ruby → Unaccent
173
165
  test_files:
metadata.gz.sig CHANGED
Binary file