polish_chars 0.0.2 → 0.0.3
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.
- data/README.md +8 -5
- data/lib/polish_chars/core_ext/string.rb +14 -22
- data/polish_chars.gemspec +5 -5
- metadata +6 -6
data/README.md
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
# PolishChars
|
2
2
|
|
3
3
|
Gem extends the Ruby `String` class methods, such as `#downcase` and `#upcase` by
|
4
|
-
handling Polish diacritics. It also adds `#no_pl` method.
|
4
|
+
handling Polish diacritics. It also adds `#no_pl` method. It's much faster then
|
5
|
+
gem named `polskie_stringi`.
|
5
6
|
|
6
7
|
## Installation
|
7
8
|
|
@@ -19,8 +20,10 @@ Or install it yourself as:
|
|
19
20
|
|
20
21
|
## Usage
|
21
22
|
|
22
|
-
|
23
|
+
Example:
|
23
24
|
|
24
|
-
|
25
|
-
|
26
|
-
|
25
|
+
require "polish_chars"
|
26
|
+
|
27
|
+
text = "Zażółć Gęślą Jaźń"
|
28
|
+
text.downcase # => "zażółć gęślą jaźń"
|
29
|
+
text.upcase # => "ZAŻÓŁĆ GĘŚLĄ JAŹŃ"
|
@@ -1,7 +1,6 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
3
|
class ::String
|
4
|
-
|
5
4
|
BIG_TO_SMALL_PL = {
|
6
5
|
'Ą' => 'ą',
|
7
6
|
'Ć' => 'ć',
|
@@ -16,28 +15,22 @@ class ::String
|
|
16
15
|
|
17
16
|
SMALL_TO_BIG_PL = BIG_TO_SMALL_PL.invert
|
18
17
|
|
19
|
-
|
20
|
-
|
18
|
+
BIG_CHARS_REGEXP = Regexp.new("[A-Z#{BIG_TO_SMALL_PL.keys.join}]")
|
19
|
+
SMALL_CHARS_REGEXP = Regexp.new("[a-z#{SMALL_TO_BIG_PL.keys.join}]")
|
20
|
+
|
21
|
+
BIG_PL_REGEXP = Regexp.new("[#{BIG_TO_SMALL_PL.keys.join}]")
|
22
|
+
SMALL_PL_REGEXP = Regexp.new("[#{SMALL_TO_BIG_PL.keys.join}]")
|
21
23
|
|
22
24
|
PL_TO_ASCII = {
|
23
|
-
'ą' => 'a',
|
24
|
-
'
|
25
|
-
'
|
26
|
-
'
|
27
|
-
'
|
28
|
-
'
|
29
|
-
'
|
30
|
-
'
|
31
|
-
'
|
32
|
-
'Ń' => 'N',
|
33
|
-
'ó' => 'o',
|
34
|
-
'Ó' => 'O',
|
35
|
-
'ś' => 's',
|
36
|
-
'Ś' => 'S',
|
37
|
-
'ź' => 'z',
|
38
|
-
'Ż' => 'Z',
|
39
|
-
'ż' => 'z',
|
40
|
-
'Ź' => 'Z'
|
25
|
+
'ą' => 'a', 'Ą' => 'A',
|
26
|
+
'ć' => 'c', 'Ć' => 'C',
|
27
|
+
'ę' => 'e', 'Ę' => 'E',
|
28
|
+
'ł' => 'l', 'Ł' => 'L',
|
29
|
+
'ń' => 'n', 'Ń' => 'N',
|
30
|
+
'ó' => 'o', 'Ó' => 'O',
|
31
|
+
'ś' => 's', 'Ś' => 'S',
|
32
|
+
'ź' => 'z', 'Ż' => 'Z',
|
33
|
+
'ż' => 'z', 'Ź' => 'Z'
|
41
34
|
}
|
42
35
|
|
43
36
|
PL_REGEXP = Regexp.new("([#{PL_TO_ASCII.keys.join}])")
|
@@ -87,5 +80,4 @@ class ::String
|
|
87
80
|
def no_pl!
|
88
81
|
replace no_pl
|
89
82
|
end
|
90
|
-
|
91
83
|
end
|
data/polish_chars.gemspec
CHANGED
@@ -4,14 +4,14 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
|
5
5
|
Gem::Specification.new do |gem|
|
6
6
|
gem.name = "polish_chars"
|
7
|
-
gem.version = "0.0.
|
7
|
+
gem.version = "0.0.3"
|
8
8
|
gem.authors = ["snukky"]
|
9
9
|
gem.email = ["snk987@gmail.com"]
|
10
|
-
gem.description = %q{Gem extends the Ruby String class methods, such
|
11
|
-
as #downcase and #upcase by handling Polish diacritics.
|
10
|
+
gem.description = %q{Gem extends some of the Ruby String class methods, such
|
11
|
+
as #downcase and #upcase, by handling Polish diacritics.
|
12
12
|
It also adds #no_pl method.}
|
13
|
-
gem.summary = %q{
|
14
|
-
diacritics.}
|
13
|
+
gem.summary = %q{An extension of Ruby String class methods for handling
|
14
|
+
Polish diacritics.}
|
15
15
|
gem.homepage = "https://github.com/snukky/polish_chars"
|
16
16
|
|
17
17
|
gem.files = `git ls-files`.split($/)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: polish_chars
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,10 +9,10 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-06-21 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
|
-
description: ! "Gem extends the Ruby String class methods, such \n as
|
15
|
-
#downcase and #upcase by handling Polish diacritics. \n It
|
14
|
+
description: ! "Gem extends some of the Ruby String class methods, such \n as
|
15
|
+
#downcase and #upcase, by handling Polish diacritics. \n It
|
16
16
|
also adds #no_pl method."
|
17
17
|
email:
|
18
18
|
- snk987@gmail.com
|
@@ -51,9 +51,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
51
51
|
version: '0'
|
52
52
|
requirements: []
|
53
53
|
rubyforge_project:
|
54
|
-
rubygems_version: 1.8.
|
54
|
+
rubygems_version: 1.8.10
|
55
55
|
signing_key:
|
56
56
|
specification_version: 3
|
57
|
-
summary:
|
57
|
+
summary: An extension of Ruby String class methods for handling Polish diacritics.
|
58
58
|
test_files:
|
59
59
|
- test/test_polish_chars.rb
|