diacritics 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +1 -1
- data/.ruby-version +1 -1
- data/.travis.yml +2 -1
- data/CHANGELOG.md +11 -6
- data/Gemfile +1 -2
- data/Guardfile +1 -1
- data/README.md +11 -7
- data/diacritics.gemspec +2 -2
- data/lib/diacritics.rb +0 -1
- data/lib/diacritics/alphabet.rb +170 -171
- data/lib/diacritics/string.rb +8 -24
- data/lib/diacritics/version.rb +1 -1
- data/spec/diacritics/string_spec.rb +39 -10
- metadata +18 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6dce2222cc44039074138a5bad8c19a7f8f4e5ec
|
4
|
+
data.tar.gz: e1497d04a6141d1466325611c20f3ba3ff5d3c0a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7c1ab640844f696417ac9368e88241db44db929817b65c20af82d7429a51b4467b34f16adbe18c107a16e93c7dc8397ada3a949bf5aa2b498def950ac8d39918
|
7
|
+
data.tar.gz: 67d4a6507128e8529ef67023f55d1f9fa588c034ac6c3dd42d61678f2867c29fae8f66f364f45da9c5024a70db049e25802620cae85d4418690c76f38eb9414b
|
data/.rubocop.yml
CHANGED
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.
|
1
|
+
2.2.0
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,15 +1,20 @@
|
|
1
|
-
## v0.0.
|
1
|
+
## v0.0.5
|
2
2
|
|
3
|
-
*
|
3
|
+
* Check if the string is permanent?
|
4
|
+
* Check if the string is slug? (only alphanumeric, - and _)
|
4
5
|
|
5
|
-
## v0.0.
|
6
|
+
## v0.0.4
|
6
7
|
|
7
|
-
|
8
|
+
Nothing new. Updated rspec tests v3.0.
|
8
9
|
|
9
10
|
## v0.0.3
|
10
11
|
|
11
12
|
* benchmark
|
12
13
|
|
13
|
-
## v0.0.
|
14
|
+
## v0.0.2
|
14
15
|
|
15
|
-
|
16
|
+
* simpler way to use downcase, upcase and permanent in String class
|
17
|
+
|
18
|
+
## v0.0.1
|
19
|
+
|
20
|
+
* initial release
|
data/Gemfile
CHANGED
@@ -1,12 +1,11 @@
|
|
1
1
|
source 'https://rubygems.org'
|
2
2
|
|
3
|
-
# Specify your gem's dependencies in diacritics.gemspec
|
4
3
|
gemspec
|
5
4
|
|
6
5
|
group :development, :test do
|
7
6
|
gem 'coveralls', require: false
|
8
7
|
gem 'codeclimate-test-reporter', require: false
|
9
|
-
gem 'rspec', '~> 3.0.0
|
8
|
+
gem 'rspec', '~> 3.0.0'
|
10
9
|
gem 'reek'
|
11
10
|
gem 'guard'
|
12
11
|
gem 'guard-bundler'
|
data/Guardfile
CHANGED
data/README.md
CHANGED
@@ -1,4 +1,10 @@
|
|
1
|
-
# Diacritics
|
1
|
+
# Diacritics
|
2
|
+
[![Gem Version](https://badge.fury.io/rb/diacritics.png)](http://badge.fury.io/rb/diacritics)
|
3
|
+
[![Build Status](https://travis-ci.org/fractalsoft/diacritics.png)](https://travis-ci.org/fractalsoft/diacritics)
|
4
|
+
[![Dependency Status](https://gemnasium.com/fractalsoft/diacritics.png)](https://gemnasium.com/fractalsoft/diacritics)
|
5
|
+
[![Coverage Status](https://coveralls.io/repos/fractalsoft/diacritics/badge.png)](https://coveralls.io/r/fractalsoft/diacritics)
|
6
|
+
[![Code Climate](https://codeclimate.com/repos/5284c9f156b1021a6e016740/badges/030f7f569aa0fa54ea66/gpa.png)](https://codeclimate.com/repos/5284c9f156b1021a6e016740/feed)
|
7
|
+
[![Stories in Ready](https://badge.waffle.io/fractalsoft/diacritics.png)](http://waffle.io/fractalsoft/diacritics)
|
2
8
|
[![endorse](https://api.coderwall.com/torrocus/endorsecount.png)](https://coderwall.com/torrocus)
|
3
9
|
|
4
10
|
Diacritics is a gem which support downcase, upcase and permanent link with diacritical characters.
|
@@ -19,12 +25,6 @@ Or install it yourself as:
|
|
19
25
|
|
20
26
|
## Usage
|
21
27
|
|
22
|
-
```ruby
|
23
|
-
Diacritics::downcase(text)
|
24
|
-
Diacritics::upcase(text)
|
25
|
-
Diacritics::permanent(text)
|
26
|
-
```
|
27
|
-
|
28
28
|
You can include methods into String class:
|
29
29
|
|
30
30
|
```ruby
|
@@ -37,6 +37,10 @@ and use
|
|
37
37
|
"ŁoreM Ìpsum Ðolór. Šit Ämet".downcase #=> "łorem ìpsum ðolór. šit ämet"
|
38
38
|
"łorem ìpsum ðolÓr. šit ämet".upcase #=> "ŁOREM ÌPSUM ÐOLÓR. ŠIT ÄMET"
|
39
39
|
"Łorem ìpsum ÐolÓr. Šit ämet".permanent #=> "lorem-ipsum-dolor-sit-aemet"
|
40
|
+
'lorem-ipsum-dolor-sit-aemet'.permanent? #=> true
|
41
|
+
'łorem ìpsum ðolór. šit ämet'.permanent? #=> false
|
42
|
+
'lorem-ipsum-dolor-sit-aemet'.slug? #=> true
|
43
|
+
'lorem@ipsum-dolor-sit-aemet'.slug? #=> false
|
40
44
|
```
|
41
45
|
|
42
46
|
## Contributing
|
data/diacritics.gemspec
CHANGED
@@ -6,7 +6,7 @@ require 'diacritics/version'
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
7
|
spec.name = 'diacritics'
|
8
8
|
spec.version = Diacritics::VERSION
|
9
|
-
spec.authors = ['Aleksander Malaszkiewicz']
|
9
|
+
spec.authors = ['Aleksander Malaszkiewicz', 'Agnieszka Matysek']
|
10
10
|
spec.email = ['info@fractalsoft.org']
|
11
11
|
spec.summary = %q{Support diacritics}
|
12
12
|
spec.homepage = 'https://github.com/fractalsoft/diacritics'
|
@@ -17,6 +17,6 @@ Gem::Specification.new do |spec|
|
|
17
17
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
18
18
|
spec.require_paths = ['lib']
|
19
19
|
|
20
|
-
spec.add_development_dependency 'bundler'
|
20
|
+
spec.add_development_dependency 'bundler'
|
21
21
|
spec.add_development_dependency 'rake'
|
22
22
|
end
|
data/lib/diacritics.rb
CHANGED
data/lib/diacritics/alphabet.rb
CHANGED
@@ -2,181 +2,180 @@
|
|
2
2
|
|
3
3
|
# Diacritics private class
|
4
4
|
module Diacritics
|
5
|
-
|
6
5
|
private
|
7
6
|
|
8
|
-
|
9
|
-
|
10
|
-
|
7
|
+
# Characters from many alphabets
|
8
|
+
class Alphabet
|
9
|
+
attr_reader :regexp, :hash
|
10
|
+
|
11
|
+
def initialize
|
12
|
+
@downcase, @upcase, @permanent = [], [], []
|
13
|
+
prepare_alphabet
|
14
|
+
@hash, @regexp = prepare_hash, prepare_regexp
|
15
|
+
end
|
11
16
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
17
|
+
private
|
18
|
+
|
19
|
+
def prepare_alphabet
|
20
|
+
data.each_pair do |_language, hash|
|
21
|
+
@downcase += hash[:downcase]
|
22
|
+
@upcase += hash[:upcase]
|
23
|
+
@permanent += hash[:permanent]
|
16
24
|
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def prepare_hash
|
28
|
+
klass = Diacritics::Alphabet
|
29
|
+
hash = klass.hashed(@downcase, @upcase)
|
30
|
+
one = klass.hashed(@downcase, @permanent)
|
31
|
+
two = klass.hashed(@upcase, @permanent)
|
32
|
+
{
|
33
|
+
downcase: hash.invert,
|
34
|
+
upcase: hash,
|
35
|
+
permanent: one.merge(two)
|
36
|
+
}
|
37
|
+
end
|
38
|
+
|
39
|
+
def prepare_regexp
|
40
|
+
downcase, upcase = @upcase.join, @downcase.join
|
41
|
+
permanent = (@downcase + @upcase).uniq.join
|
42
|
+
{
|
43
|
+
downcase: /[#{downcase}]/,
|
44
|
+
upcase: /[#{upcase}]/,
|
45
|
+
permanent: /[#{permanent}]/
|
46
|
+
}
|
47
|
+
end
|
48
|
+
|
49
|
+
# Creates a hash from two arrays
|
50
|
+
#
|
51
|
+
# ["a", "b"], ["A", "B"] #=> {"a" => "A", "b" => "B"}
|
52
|
+
def self.hashed(one, two)
|
53
|
+
hash = {}
|
54
|
+
[one, two].transpose.each { |key, value| hash[key] = value }
|
55
|
+
hash
|
56
|
+
end
|
57
|
+
|
58
|
+
def data
|
59
|
+
{
|
60
|
+
en: en, de: de, pl: pl, cs: cs, fr: fr, it: it, eo: eo,
|
61
|
+
is: is, pt: pt, sp: sp, hu: hu, nn: nn, ru: ru, gr: gr
|
62
|
+
}
|
63
|
+
end
|
64
|
+
|
65
|
+
def en
|
66
|
+
{ # English
|
67
|
+
downcase: [' ', '?', '.', ','],
|
68
|
+
upcase: [' ', '?', '.', ','],
|
69
|
+
permanent: ['-', '', '', '']
|
70
|
+
}
|
71
|
+
end
|
72
|
+
|
73
|
+
def de
|
74
|
+
{ # German
|
75
|
+
downcase: %w(ä ö ü ß),
|
76
|
+
upcase: %w(Ä Ö Ü ẞ),
|
77
|
+
permanent: %w(ae oe ue ss)
|
78
|
+
}
|
79
|
+
end
|
80
|
+
|
81
|
+
def pl
|
82
|
+
{ # Polish
|
83
|
+
downcase: %w(ą ć ę ł ń ó ś ż ź),
|
84
|
+
upcase: %w(Ą Ć Ę Ł Ń Ó Ś Ż Ź),
|
85
|
+
permanent: %w(a c e l n o s z z)
|
86
|
+
}
|
87
|
+
end
|
88
|
+
|
89
|
+
def cs
|
90
|
+
{ # Czech
|
91
|
+
downcase: %w(á č í ř š ý ž),
|
92
|
+
upcase: %w(Á Č Í Ř Š Ý Ž),
|
93
|
+
permanent: %w(a c i r s y z)
|
94
|
+
}
|
95
|
+
end
|
96
|
+
|
97
|
+
def fr
|
98
|
+
{ # French
|
99
|
+
downcase: %w(à é è ê ô),
|
100
|
+
upcase: %w(À É È Ê Ô),
|
101
|
+
permanent: %w(a e e e o)
|
102
|
+
}
|
103
|
+
end
|
104
|
+
|
105
|
+
def it
|
106
|
+
{ # Italian
|
107
|
+
downcase: %w(ì ù ò),
|
108
|
+
upcase: %w(Ì Ù Ò),
|
109
|
+
permanent: %w(i u o)
|
110
|
+
}
|
111
|
+
end
|
112
|
+
|
113
|
+
def eo
|
114
|
+
{ # Esperanto
|
115
|
+
downcase: %w(ĉ ĝ ĥ ĵ ŝ ŭ),
|
116
|
+
upcase: %w(Ĉ Ĝ Ĥ Ĵ Ŝ Ŭ),
|
117
|
+
permanent: %w(c g h j s u)
|
118
|
+
}
|
119
|
+
end
|
120
|
+
|
121
|
+
def is
|
122
|
+
{ # Iceland
|
123
|
+
downcase: %w(ð þ),
|
124
|
+
upcase: %w(Ð Þ),
|
125
|
+
permanent: %w(d p)
|
126
|
+
}
|
127
|
+
end
|
128
|
+
|
129
|
+
def pt
|
130
|
+
{ # Portugal
|
131
|
+
downcase: %w(ã ç),
|
132
|
+
upcase: %w(Ã Ç),
|
133
|
+
permanent: %w(a c)
|
134
|
+
}
|
135
|
+
end
|
136
|
+
|
137
|
+
def sp
|
138
|
+
{ # Spanish
|
139
|
+
downcase: ['¿'],
|
140
|
+
upcase: ['¿'],
|
141
|
+
permanent: ['']
|
142
|
+
}
|
143
|
+
end
|
144
|
+
|
145
|
+
def hu
|
146
|
+
{ # Hungarian
|
147
|
+
downcase: %w(ő),
|
148
|
+
upcase: %w(Ő),
|
149
|
+
permanent: %w(oe)
|
150
|
+
}
|
151
|
+
end
|
152
|
+
|
153
|
+
def nn
|
154
|
+
{ # Norwegian
|
155
|
+
downcase: %w(æ å),
|
156
|
+
upcase: %w(Æ Å),
|
157
|
+
permanent: %w(ae a)
|
158
|
+
}
|
159
|
+
end
|
160
|
+
|
161
|
+
def ru
|
162
|
+
{ # Russian
|
163
|
+
downcase: %w(
|
164
|
+
а б в г д е ё ж з и й к л м н о п р с т у ф х ц ч ш ы ь ю я),
|
165
|
+
upcase: %w(
|
166
|
+
А Б В Г Д Е Ё Ж З И Й К Л М Н О П Р С Т У Ф Х Ц Ч Ш Ы Ь Ю Я),
|
167
|
+
permanent: %w(
|
168
|
+
а б в г д е ё ж з и й к л м н о п р с т у ф х ц ч ш ы ь ю я)
|
169
|
+
}
|
170
|
+
end
|
17
171
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
def prepare_hash
|
29
|
-
klass = Diacritics::Alphabet
|
30
|
-
hash = klass.hashed(@downcase, @upcase)
|
31
|
-
one = klass.hashed(@downcase, @permanent)
|
32
|
-
two = klass.hashed(@upcase, @permanent)
|
33
|
-
{
|
34
|
-
downcase: hash.invert,
|
35
|
-
upcase: hash,
|
36
|
-
permanent: one.merge(two),
|
37
|
-
}
|
38
|
-
end
|
39
|
-
|
40
|
-
def prepare_regexp
|
41
|
-
downcase, upcase = @upcase.join, @downcase.join
|
42
|
-
permanent = (@downcase + @upcase).uniq.join
|
43
|
-
{
|
44
|
-
downcase: /[#{downcase}]/,
|
45
|
-
upcase: /[#{upcase}]/,
|
46
|
-
permanent: /[#{permanent}]/,
|
47
|
-
}
|
48
|
-
end
|
49
|
-
|
50
|
-
# Creates a hash from two arrays
|
51
|
-
#
|
52
|
-
# ["a", "b"], ["A", "B"] #=> {"a" => "A", "b" => "B"}
|
53
|
-
def self.hashed(one, two)
|
54
|
-
hash = {}
|
55
|
-
[one, two].transpose.each { |key, value| hash[key] = value }
|
56
|
-
hash
|
57
|
-
end
|
58
|
-
|
59
|
-
def data
|
60
|
-
{
|
61
|
-
en: en, de: de, pl: pl, cs: cs, fr: fr, it: it, eo: eo,
|
62
|
-
is: is, pt: pt, sp: sp, hu: hu, nn: nn, ru: ru, gr: gr
|
63
|
-
}
|
64
|
-
end
|
65
|
-
|
66
|
-
def en
|
67
|
-
{ # English
|
68
|
-
downcase: [' ', '?', '.', ','],
|
69
|
-
upcase: [' ', '?', '.', ','],
|
70
|
-
permanent: ['-', '', '', ''],
|
71
|
-
}
|
72
|
-
end
|
73
|
-
|
74
|
-
def de
|
75
|
-
{ # German
|
76
|
-
downcase: %w[ä ö ü ß],
|
77
|
-
upcase: %w[Ä Ö Ü ẞ],
|
78
|
-
permanent: %w[ae oe ue ss]
|
79
|
-
}
|
80
|
-
end
|
81
|
-
|
82
|
-
def pl
|
83
|
-
{ # Polish
|
84
|
-
downcase: %w[ą ć ę ł ń ó ś ż ź],
|
85
|
-
upcase: %w[Ą Ć Ę Ł Ń Ó Ś Ż Ź],
|
86
|
-
permanent: %w[a c e l n o s z z]
|
87
|
-
}
|
88
|
-
end
|
89
|
-
|
90
|
-
def cs
|
91
|
-
{ # Czech
|
92
|
-
downcase: %w[á č í ř š ý ž],
|
93
|
-
upcase: %w[Á Č Í Ř Š Ý Ž],
|
94
|
-
permanent: %w[a c i r s y z]
|
95
|
-
}
|
96
|
-
end
|
97
|
-
|
98
|
-
def fr
|
99
|
-
{ # French
|
100
|
-
downcase: %w[à é è ê ô],
|
101
|
-
upcase: %w[À É È Ê Ô],
|
102
|
-
permanent: %w[a e e e o]
|
103
|
-
}
|
104
|
-
end
|
105
|
-
|
106
|
-
def it
|
107
|
-
{ # Italian
|
108
|
-
downcase: %w[ì ù ò],
|
109
|
-
upcase: %w[Ì Ù Ò],
|
110
|
-
permanent: %w[i u o]
|
111
|
-
}
|
112
|
-
end
|
113
|
-
|
114
|
-
def eo
|
115
|
-
{ # Esperanto
|
116
|
-
downcase: %w[ĉ ĝ ĥ ĵ ŝ ŭ],
|
117
|
-
upcase: %w[Ĉ Ĝ Ĥ Ĵ Ŝ Ŭ],
|
118
|
-
permanent: %w[c g h j s u]
|
119
|
-
}
|
120
|
-
end
|
121
|
-
|
122
|
-
def is
|
123
|
-
{ # Iceland
|
124
|
-
downcase: %w[ð þ],
|
125
|
-
upcase: %w[Ð Þ],
|
126
|
-
permanent: %w[d p]
|
127
|
-
}
|
128
|
-
end
|
129
|
-
|
130
|
-
def pt
|
131
|
-
{ # Portugal
|
132
|
-
downcase: %w[ã ç],
|
133
|
-
upcase: %w[Ã Ç],
|
134
|
-
permanent: %w[a c]
|
135
|
-
}
|
136
|
-
end
|
137
|
-
|
138
|
-
def sp
|
139
|
-
{ # Spanish
|
140
|
-
downcase: ['¿'],
|
141
|
-
upcase: ['¿'],
|
142
|
-
permanent: ['']
|
143
|
-
}
|
144
|
-
end
|
145
|
-
|
146
|
-
def hu
|
147
|
-
{ # Hungarian
|
148
|
-
downcase: %w[ő],
|
149
|
-
upcase: %w[Ő],
|
150
|
-
permanent: %w[oe]
|
151
|
-
}
|
152
|
-
end
|
153
|
-
|
154
|
-
def nn
|
155
|
-
{ # Norwegian
|
156
|
-
downcase: %w[æ å],
|
157
|
-
upcase: %w[Æ Å],
|
158
|
-
permanent: %w[ae a]
|
159
|
-
}
|
160
|
-
end
|
161
|
-
|
162
|
-
def ru
|
163
|
-
{ # Russian
|
164
|
-
downcase: %w[
|
165
|
-
а б в г д е ё ж з и й к л м н о п р с т у ф х ц ч ш ы ь ю я],
|
166
|
-
upcase: %w[
|
167
|
-
А Б В Г Д Е Ё Ж З И Й К Л М Н О П Р С Т У Ф Х Ц Ч Ш Ы Ь Ю Я],
|
168
|
-
permanent: %w[
|
169
|
-
а б в г д е ё ж з и й к л м н о п р с т у ф х ц ч ш ы ь ю я]
|
170
|
-
}
|
171
|
-
end
|
172
|
-
|
173
|
-
def gr
|
174
|
-
{ # Greek
|
175
|
-
downcase: %w[α ά γ δ ε έ ζ η θ ι ί κ λ μ ν ξ ο ό π ρ σ τ υ φ ψ],
|
176
|
-
upcase: %w[Α Ά Γ Δ Ε Έ Ζ Η Θ Ι Ί Κ Λ Μ Ν Ξ Ο Ό Π Ρ Σ Τ Υ Φ Ψ],
|
177
|
-
permanent: %w[
|
178
|
-
a a g d e e z e th i i k l m n x o o p r s t y ph ps]
|
179
|
-
}
|
180
|
-
end
|
172
|
+
def gr
|
173
|
+
{ # Greek
|
174
|
+
downcase: %w(α ά γ δ ε έ ζ η θ ι ί κ λ μ ν ξ ο ό π ρ σ τ υ φ ψ),
|
175
|
+
upcase: %w(Α Ά Γ Δ Ε Έ Ζ Η Θ Ι Ί Κ Λ Μ Ν Ξ Ο Ό Π Ρ Σ Τ Υ Φ Ψ),
|
176
|
+
permanent: %w(
|
177
|
+
a a g d e e z e th i i k l m n x o o p r s t y ph ps)
|
178
|
+
}
|
181
179
|
end
|
180
|
+
end
|
182
181
|
end
|
data/lib/diacritics/string.rb
CHANGED
@@ -2,30 +2,6 @@
|
|
2
2
|
module Diacritics
|
3
3
|
# Include this into String class
|
4
4
|
module String
|
5
|
-
# @deprecated Please use {#downcase} instead.
|
6
|
-
def diacritics_downcase
|
7
|
-
# rubocop:disable all
|
8
|
-
warn '[DEPRECATION] `diacritics_downcase` is depraceted. Please use `downcase` instead.'
|
9
|
-
# rubocop:enable all
|
10
|
-
send :downcase
|
11
|
-
end
|
12
|
-
|
13
|
-
# @deprecated Please use {#upcase} instead.
|
14
|
-
def diacritics_upcase
|
15
|
-
# rubocop:disable all
|
16
|
-
warn '[DEPRECATION] `diacritics_upcase` is depraceted. Please use `upcase` instead.'
|
17
|
-
# rubocop:enable all
|
18
|
-
send :upcase
|
19
|
-
end
|
20
|
-
|
21
|
-
# @deprecated Please use {#permanent} instead.
|
22
|
-
def permanent_link
|
23
|
-
# rubocop:disable all
|
24
|
-
warn '[DEPRECATION] `permanent_link` is depraceted. Please use `permanent` instead.'
|
25
|
-
# rubocop:enable all
|
26
|
-
send :permanent
|
27
|
-
end
|
28
|
-
|
29
5
|
def self.included(klass)
|
30
6
|
klass.class_eval do
|
31
7
|
def downcase
|
@@ -41,5 +17,13 @@ module Diacritics
|
|
41
17
|
def permanent
|
42
18
|
Diacritics::Cases.instance.permanent self
|
43
19
|
end
|
20
|
+
|
21
|
+
def permanent?
|
22
|
+
Diacritics::Cases.instance.permanent(self) == self
|
23
|
+
end
|
24
|
+
|
25
|
+
def slug?
|
26
|
+
!match(/^[[:alnum:][_-]]+$/).nil?
|
27
|
+
end
|
44
28
|
end
|
45
29
|
end
|
data/lib/diacritics/version.rb
CHANGED
@@ -16,6 +16,12 @@ describe Diacritics::String do
|
|
16
16
|
describe '#permanent' do
|
17
17
|
it { expect(subject.permanent).to eq result[2] }
|
18
18
|
end
|
19
|
+
|
20
|
+
describe '#pernament?' do
|
21
|
+
let(:permanent) { subject.permanent }
|
22
|
+
it { expect(subject).not_to be_permanent }
|
23
|
+
it { expect(permanent).to be_permanent }
|
24
|
+
end
|
19
25
|
end
|
20
26
|
|
21
27
|
context 'English' do
|
@@ -74,11 +80,11 @@ describe Diacritics::String do
|
|
74
80
|
it_behaves_like 'word processing' do
|
75
81
|
subject { 'Ödögidöggi' }
|
76
82
|
let(:result) do
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
83
|
+
%w(
|
84
|
+
ödögidöggi
|
85
|
+
ÖDÖGIDÖGGI
|
86
|
+
oedoegidoeggi
|
87
|
+
)
|
82
88
|
end
|
83
89
|
end
|
84
90
|
end
|
@@ -475,11 +481,11 @@ describe Diacritics::String do
|
|
475
481
|
it_behaves_like 'word processing' do
|
476
482
|
subject { 'Nyelvtörők' }
|
477
483
|
let(:result) do
|
478
|
-
|
479
|
-
|
480
|
-
|
481
|
-
|
482
|
-
|
484
|
+
%w(
|
485
|
+
nyelvtörők
|
486
|
+
NYELVTÖRŐK
|
487
|
+
nyelvtoeroek
|
488
|
+
)
|
483
489
|
end
|
484
490
|
end
|
485
491
|
end
|
@@ -496,4 +502,27 @@ describe Diacritics::String do
|
|
496
502
|
end
|
497
503
|
end
|
498
504
|
end
|
505
|
+
|
506
|
+
context do
|
507
|
+
it { expect('lorem-ipsum').to be_slug }
|
508
|
+
it { expect('lorem_ipsum').to be_slug }
|
509
|
+
it { expect('lorem!ipsum').not_to be_slug }
|
510
|
+
it { expect('lorem#ipsum').not_to be_slug }
|
511
|
+
it { expect('lorem$ipsum').not_to be_slug }
|
512
|
+
it { expect('lorem&ipsum').not_to be_slug }
|
513
|
+
it { expect("lorem'ipsum").not_to be_slug }
|
514
|
+
it { expect('lorem(ipsum').not_to be_slug }
|
515
|
+
it { expect('lorem)ipsum').not_to be_slug }
|
516
|
+
it { expect('lorem+ipsum').not_to be_slug }
|
517
|
+
it { expect('lorem,ipsum').not_to be_slug }
|
518
|
+
it { expect('lorem/ipsum').not_to be_slug }
|
519
|
+
it { expect('lorem:ipsum').not_to be_slug }
|
520
|
+
it { expect('lorem;ipsum').not_to be_slug }
|
521
|
+
it { expect('lorem?ipsum').not_to be_slug }
|
522
|
+
it { expect('lorem@ipsum').not_to be_slug }
|
523
|
+
it { expect('lorem[ipsum').not_to be_slug }
|
524
|
+
it { expect('lorem]ipsum').not_to be_slug }
|
525
|
+
it { expect('lorem{ipsum').not_to be_slug }
|
526
|
+
it { expect('lorem}ipsum').not_to be_slug }
|
527
|
+
end
|
499
528
|
end
|
metadata
CHANGED
@@ -1,41 +1,42 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: diacritics
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aleksander Malaszkiewicz
|
8
|
+
- Agnieszka Matysek
|
8
9
|
autorequire:
|
9
10
|
bindir: bin
|
10
11
|
cert_chain: []
|
11
|
-
date:
|
12
|
+
date: 2015-04-02 00:00:00.000000000 Z
|
12
13
|
dependencies:
|
13
14
|
- !ruby/object:Gem::Dependency
|
14
15
|
name: bundler
|
15
16
|
requirement: !ruby/object:Gem::Requirement
|
16
17
|
requirements:
|
17
|
-
- -
|
18
|
+
- - ">="
|
18
19
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
20
|
+
version: '0'
|
20
21
|
type: :development
|
21
22
|
prerelease: false
|
22
23
|
version_requirements: !ruby/object:Gem::Requirement
|
23
24
|
requirements:
|
24
|
-
- -
|
25
|
+
- - ">="
|
25
26
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
27
|
+
version: '0'
|
27
28
|
- !ruby/object:Gem::Dependency
|
28
29
|
name: rake
|
29
30
|
requirement: !ruby/object:Gem::Requirement
|
30
31
|
requirements:
|
31
|
-
- -
|
32
|
+
- - ">="
|
32
33
|
- !ruby/object:Gem::Version
|
33
34
|
version: '0'
|
34
35
|
type: :development
|
35
36
|
prerelease: false
|
36
37
|
version_requirements: !ruby/object:Gem::Requirement
|
37
38
|
requirements:
|
38
|
-
- -
|
39
|
+
- - ">="
|
39
40
|
- !ruby/object:Gem::Version
|
40
41
|
version: '0'
|
41
42
|
description:
|
@@ -46,12 +47,12 @@ executables:
|
|
46
47
|
extensions: []
|
47
48
|
extra_rdoc_files: []
|
48
49
|
files:
|
49
|
-
- .gitignore
|
50
|
-
- .rspec
|
51
|
-
- .rubocop.yml
|
52
|
-
- .ruby-gemset
|
53
|
-
- .ruby-version
|
54
|
-
- .travis.yml
|
50
|
+
- ".gitignore"
|
51
|
+
- ".rspec"
|
52
|
+
- ".rubocop.yml"
|
53
|
+
- ".ruby-gemset"
|
54
|
+
- ".ruby-version"
|
55
|
+
- ".travis.yml"
|
55
56
|
- CHANGELOG.md
|
56
57
|
- Gemfile
|
57
58
|
- Guardfile
|
@@ -80,17 +81,17 @@ require_paths:
|
|
80
81
|
- lib
|
81
82
|
required_ruby_version: !ruby/object:Gem::Requirement
|
82
83
|
requirements:
|
83
|
-
- -
|
84
|
+
- - ">="
|
84
85
|
- !ruby/object:Gem::Version
|
85
86
|
version: '0'
|
86
87
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
87
88
|
requirements:
|
88
|
-
- -
|
89
|
+
- - ">="
|
89
90
|
- !ruby/object:Gem::Version
|
90
91
|
version: '0'
|
91
92
|
requirements: []
|
92
93
|
rubyforge_project:
|
93
|
-
rubygems_version: 2.
|
94
|
+
rubygems_version: 2.4.5
|
94
95
|
signing_key:
|
95
96
|
specification_version: 4
|
96
97
|
summary: Support diacritics
|