babosa 1.0.2 → 1.0.3

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: 63fa1835d7bbc606c85b2c8315e8619c37bc7703
4
- data.tar.gz: 4b0f3a169ed08de3a1614026e58fbc0dc00e58bc
2
+ SHA256:
3
+ metadata.gz: 220cb46c512e19edf7da5fd276cc617f091ea06914c1665c45a2126a352c0e19
4
+ data.tar.gz: '0948960e5ee0016e0995981f8474a4ac046f7403115a18ad48e56f4fece68065'
5
5
  SHA512:
6
- metadata.gz: 8581a919789c35ab9fe3c077190dcb93a20da9b0ed5ebf05cb7342fb2c4c9eeb8181e3d93850fd7564f31e95cd0195274f24e2fde938c7e6c9027aa02a4ccd15
7
- data.tar.gz: 6a86041c30dcd1cdbf5a39b1d2f319425656e57135856aa90a32fffd181fe85748676f74fbb25254294f8d8c6c63f1574b087a32f1d2d112ce84ae40f932c8b4
6
+ metadata.gz: bf56ad4637bd37dd3e0efcee9a01ab552d7eb23aa01d95df77485c92f86440be8a80dc70fa27b066021987a65427be0f3760fb85abb83c308374a079e808ff8f
7
+ data.tar.gz: 86fcc2dd507f57bca63220d0da299695cbee0584b3aee1116b20c1a8773b2db585e7a1b46db652292a55d78cf1accebd2f172c196a34724e66c16cb806ea7566
@@ -1,5 +1,9 @@
1
1
  # Babosa Changelog
2
2
 
3
+ ## 1.0.3
4
+
5
+ * Fix Active Support 6 deprecations (https://github.com/norman/babosa/pull/50)
6
+
3
7
  ## 1.0.2
4
8
 
5
9
  * Fix regression in ActiveSupport UTF8 proxy.
data/README.md CHANGED
@@ -218,8 +218,8 @@ Babosa can be installed via Rubygems:
218
218
 
219
219
  You can get the source code from its [Github repository](http://github.com/norman/babosa).
220
220
 
221
- Babosa is tested to be compatible with Ruby 1.8.7-2.0.0, JRuby 1.4+, and
222
- Rubinius 1.0+ It's probably compatible with other Rubies as well.
221
+ Babosa is tested to be compatible with Ruby 2.x, JRuby 1.7+, and
222
+ Rubinius 2.x It's probably compatible with other Rubies as well.
223
223
 
224
224
  ## Reporting bugs
225
225
 
@@ -239,6 +239,7 @@ tracker](http://github.com/norman/babosa/issues).
239
239
 
240
240
  Many thanks to the following people for their help:
241
241
 
242
+ * [Dmitry A. Ilyashevich](https://github.com/dmitry-ilyashevich) - Deprecation fixes
242
243
  * [anhkind](https://github.com/anhkind) - Vietnamese support
243
244
  * [Martins Zakis](https://github.com/martins) - Bug fixes
244
245
  * [Vassilis Rodokanakis](https://github.com/vrodokanakis) - Greek support
@@ -255,7 +256,6 @@ Many thanks to the following people for their help:
255
256
  * [Molte Emil Strange Andersen](https://github.com/molte) - Danish support
256
257
  * [Milan Dobrota](https://github.com/milandobrota) - Serbian support
257
258
 
258
-
259
259
  ## Copyright
260
260
 
261
261
  Copyright (c) 2010-2013 Norman Clarke
@@ -276,4 +276,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
276
276
  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
277
277
  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
278
278
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
279
- SOFTWARE.
279
+ SOFTWARE.
@@ -37,7 +37,7 @@ module Babosa
37
37
 
38
38
  @@utf8_proxy = if Babosa.jruby15?
39
39
  UTF8::JavaProxy
40
- elsif defined? Unicode
40
+ elsif defined? Unicode::VERSION
41
41
  UTF8::UnicodeProxy
42
42
  elsif defined? ActiveSupport
43
43
  UTF8::ActiveSupportProxy
@@ -10,6 +10,7 @@ module Babosa
10
10
  autoload :Cyrillic, "babosa/transliterator/cyrillic"
11
11
  autoload :Danish, "babosa/transliterator/danish"
12
12
  autoload :German, "babosa/transliterator/german"
13
+ autoload :Hindi, "babosa/transliterator/hindi"
13
14
  autoload :Latin, "babosa/transliterator/latin"
14
15
  autoload :Macedonian, "babosa/transliterator/macedonian"
15
16
  autoload :Norwegian, "babosa/transliterator/norwegian"
@@ -21,6 +22,7 @@ module Babosa
21
22
  autoload :Ukrainian, "babosa/transliterator/ukrainian"
22
23
  autoload :Greek, "babosa/transliterator/greek"
23
24
  autoload :Vietnamese, "babosa/transliterator/vietnamese"
25
+ autoload :Turkish, "babosa/transliterator/turkish"
24
26
 
25
27
  def self.get(symbol)
26
28
  class_name = symbol.to_s.split("_").map {|a| a.gsub(/\b('?[a-z])/) { $1.upcase }}.join
@@ -0,0 +1,137 @@
1
+ # encoding: utf-8
2
+ module Babosa
3
+ module Transliterator
4
+ class Hindi < Base
5
+ APPROXIMATIONS = {
6
+ "ऀ" => "n",
7
+ "ँ" => "n",
8
+ "ं" => "n",
9
+ "ः" => "h",
10
+ "ऄ" => "a",
11
+ "अ" => "a",
12
+ "आ" => "aa",
13
+ "इ" => "i",
14
+ "ई" => "ii",
15
+ "उ" => "u",
16
+ "ऊ" => "uu",
17
+ "ऋ" => "ri",
18
+ "ऌ" => "lri",
19
+ "ऍ" => "e",
20
+ "ऎ" => "e",
21
+ "ए" => "e",
22
+ "ऐ" => "ei",
23
+ "ऑ" => "o",
24
+ "ऒ" => "o",
25
+ "ओ" => "o",
26
+ "औ" => "ou",
27
+ "क" => "k",
28
+ "ख" => "kh",
29
+ "ग" => "g",
30
+ "घ" => "gh",
31
+ "ङ" => "d",
32
+ "च" => "ch",
33
+ "छ" => "chh",
34
+ "ज" => "j",
35
+ "झ" => "jh",
36
+ "ञ" => "ny",
37
+ "ट" => "tt",
38
+ "ठ" => "tth",
39
+ "ड" => "dd",
40
+ "ढ" => "ddh",
41
+ "ण" => "nn",
42
+ "त" => "t",
43
+ "थ" => "th",
44
+ "द" => "d",
45
+ "ध" => "dh",
46
+ "न" => "n",
47
+ "ऩ" => "nnn",
48
+ "प" => "p",
49
+ "फ" => "ph",
50
+ "ब" => "b",
51
+ "भ" => "bh",
52
+ "म" => "m",
53
+ "य" => "y",
54
+ "र" => "r",
55
+ "ऱ" => "rr",
56
+ "ल" => "l",
57
+ "ळ" => "ll",
58
+ "ऴ" => "ll",
59
+ "व" => "v",
60
+ "श" => "sh",
61
+ "ष" => "ss",
62
+ "स" => "s",
63
+ "ह" => "h",
64
+ "ऺ" => "oe",
65
+ "ऻ" => "ooe",
66
+ "़" => "",
67
+ "ऽ" => "-",
68
+ "ा" => "aa",
69
+ "ि" => "i",
70
+ "ी" => "ii",
71
+ "ु" => "u",
72
+ "ू" => "uu",
73
+ "ृ" => "r",
74
+ "ॄ" => "rr",
75
+ "ॅ" => "e",
76
+ "ॆ" => "e",
77
+ "े" => "e",
78
+ "ै" => "ai",
79
+ "ॉ" => "o",
80
+ "ॊ" => "o",
81
+ "ो" => "o",
82
+ "ौ" => "au",
83
+ "्" => "",
84
+ "ॎ" => "e",
85
+ "ॏ" => "aw",
86
+ "ॐ" => "om",
87
+ "॑" => "",
88
+ "॒" => "_",
89
+ "॓" => "",
90
+ "॔" => "",
91
+ "ॕ" => "ee",
92
+ "ॖ" => "ue",
93
+ "ॗ" => "uue",
94
+ "क़" => "q",
95
+ "ख़" => "khh",
96
+ "ग़" => "ghh",
97
+ "ज़" => "za",
98
+ "ड़" => "dddh",
99
+ "ढ़" => "rh",
100
+ "फ़" => "f",
101
+ "य़" => "yy",
102
+ "ॠ" => "rri",
103
+ "ॡ" => "lr",
104
+ "ॢ" => "l",
105
+ "ॣ" => "l",
106
+ "।" => ".",
107
+ "॥" => "..",
108
+ "०" => "0",
109
+ "१" => "1",
110
+ "२" => "2",
111
+ "३" => "3",
112
+ "४" => "4",
113
+ "५" => "5",
114
+ "६" => "6",
115
+ "७" => "7",
116
+ "८" => "8",
117
+ "९" => "9",
118
+ "॰" => ".",
119
+ "ॱ" => ".",
120
+ "ॲ" => "a",
121
+ "ॳ" => "oe",
122
+ "ॴ" => "ooe",
123
+ "ॵ" => "aw",
124
+ "ॶ" => "ue",
125
+ "ॷ" => "uue",
126
+ "ॸ" => "dd",
127
+ "ॹ" => "zh",
128
+ "ॺ" => "y",
129
+ "ॻ" => "gg",
130
+ "ॼ" => "jj",
131
+ "ॽ" => "?",
132
+ "ॾ" => "ddd",
133
+ "ॿ" => "bb"
134
+ }
135
+ end
136
+ end
137
+ end
@@ -0,0 +1,8 @@
1
+ # encoding: utf-8
2
+
3
+ module Babosa
4
+ module Transliterator
5
+ class Turkish < Latin
6
+ end
7
+ end
8
+ end
@@ -20,6 +20,18 @@ module Babosa
20
20
  def upcase(string)
21
21
  ActiveSupport::Multibyte::Chars.new(string).upcase.to_s
22
22
  end
23
+ elsif ActiveSupport::VERSION::MAJOR >= 6
24
+ def self.normalize_utf8(string)
25
+ string.unicode_normalize(:nfc).to_s
26
+ end
27
+
28
+ def downcase(string)
29
+ string.downcase.to_s
30
+ end
31
+
32
+ def upcase(string)
33
+ string.upcase.to_s
34
+ end
23
35
  end
24
36
  end
25
37
  end
@@ -1,5 +1,5 @@
1
1
  module Babosa
2
2
  module Version
3
- STRING = '1.0.2'
3
+ STRING = '1.0.3'
4
4
  end
5
5
  end
@@ -33,4 +33,13 @@ shared_examples_for "a greek transliterator" do
33
33
  string = "Γερμανία"
34
34
  expect(t.transliterate(string)).to match(/[\x0-\x7f]/)
35
35
  end
36
+ end
37
+
38
+ shared_examples_for "a hindi transliterator" do
39
+ let(:t) { described_class.instance }
40
+
41
+ it "should transliterate hindi characters" do
42
+ string = "आदित्य तापड़िया"
43
+ expect(t.transliterate(string)).to match(/[\x0-\x7f]/)
44
+ end
36
45
  end
@@ -0,0 +1,17 @@
1
+ # encoding: utf-8
2
+ require File.expand_path("../../spec_helper", __FILE__)
3
+
4
+ describe Babosa::Transliterator::Hindi do
5
+
6
+ let(:t) { described_class.instance }
7
+ it_behaves_like "a hindi transliterator"
8
+
9
+ it "should transliterate hindi characters" do
10
+ examples = {
11
+ "आदित्य" => "aadity",
12
+ "सबरीमाला करवाना पायसम" => "sbriimaalaa krvaanaa paaysm",
13
+ "सक्रांति आँख" => "skraanti aankh"
14
+ }
15
+ examples.each {|k, v| expect(t.transliterate(k)).to eql(v)}
16
+ end
17
+ end
@@ -0,0 +1,24 @@
1
+ # encoding: utf-8
2
+ require File.expand_path("../../spec_helper", __FILE__)
3
+
4
+ describe Babosa::Transliterator::Turkish do
5
+
6
+ let(:t) { described_class.instance }
7
+ it_behaves_like "a latin transliterator"
8
+
9
+ it "should transliterate various characters" do
10
+ examples = {
11
+ "Nâzım" => "Nazim",
12
+ "sükûnet" => "sukunet",
13
+ "millîleştirmek" => "millilestirmek",
14
+ "mêmur" => "memur",
15
+ "lôkman" => "lokman",
16
+ "yoğurt" => "yogurt",
17
+ "şair" => "sair",
18
+ "İzmir" => "Izmir",
19
+ "yığın" => "yigin",
20
+ "çarşı" => "carsi"
21
+ }
22
+ examples.each {|k, v| expect(t.transliterate(k)).to eql(v)}
23
+ end
24
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: babosa
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Norman Clarke
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-01-08 00:00:00.000000000 Z
11
+ date: 2019-09-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -28,16 +28,16 @@ dependencies:
28
28
  name: rspec
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: 3.1.0
33
+ version: 3.7.0
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - "~>"
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: 3.1.0
40
+ version: 3.7.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: simplecov
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -102,6 +102,7 @@ files:
102
102
  - lib/babosa/transliterator/danish.rb
103
103
  - lib/babosa/transliterator/german.rb
104
104
  - lib/babosa/transliterator/greek.rb
105
+ - lib/babosa/transliterator/hindi.rb
105
106
  - lib/babosa/transliterator/latin.rb
106
107
  - lib/babosa/transliterator/macedonian.rb
107
108
  - lib/babosa/transliterator/norwegian.rb
@@ -110,6 +111,7 @@ files:
110
111
  - lib/babosa/transliterator/serbian.rb
111
112
  - lib/babosa/transliterator/spanish.rb
112
113
  - lib/babosa/transliterator/swedish.rb
114
+ - lib/babosa/transliterator/turkish.rb
113
115
  - lib/babosa/transliterator/ukrainian.rb
114
116
  - lib/babosa/transliterator/vietnamese.rb
115
117
  - lib/babosa/utf8/active_support_proxy.rb
@@ -126,6 +128,7 @@ files:
126
128
  - spec/transliterators/danish_spec.rb
127
129
  - spec/transliterators/german_spec.rb
128
130
  - spec/transliterators/greek_spec.rb
131
+ - spec/transliterators/hindi_spec.rb
129
132
  - spec/transliterators/latin_spec.rb
130
133
  - spec/transliterators/macedonian_spec.rb
131
134
  - spec/transliterators/norwegian_spec.rb
@@ -135,6 +138,7 @@ files:
135
138
  - spec/transliterators/serbian_spec.rb
136
139
  - spec/transliterators/spanish_spec.rb
137
140
  - spec/transliterators/swedish_spec.rb
141
+ - spec/transliterators/turkish_spec.rb
138
142
  - spec/transliterators/ukrainian_spec.rb
139
143
  - spec/transliterators/vietnamese_spec.rb
140
144
  - spec/utf8_proxy_spec.rb
@@ -156,8 +160,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
156
160
  - !ruby/object:Gem::Version
157
161
  version: '0'
158
162
  requirements: []
159
- rubyforge_project:
160
- rubygems_version: 2.4.4
163
+ rubygems_version: 3.0.3
161
164
  signing_key:
162
165
  specification_version: 4
163
166
  summary: A library for creating slugs.