cyrillizer 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +9 -6
- data/lib/alphabets/serbian.yml +9 -0
- data/lib/cyrillizer/alphabet.rb +7 -0
- data/lib/cyrillizer/version.rb +1 -1
- data/spec/cyrillizer/alphabet_spec.rb +14 -10
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f132b629cde031661956744828cf17ff8bdc6905
|
4
|
+
data.tar.gz: 18b3b6fad6d9169f3125b82bbcba735e402ba3e4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4338533f55604dfb3145b03938539fe1b4ea52887ceafa57ea66e3efb8726092d2fd10c404250a68edf46f5bf19e4412ad3a48c62f7e3b644665e158e275fcc1
|
7
|
+
data.tar.gz: 6b8ea46c48daddda0df3295e66017f2ea0e1c5f4a729199f48f9a36d0b8289c8c69af93e5ae74fac8e13cea3c05c50e50e1d79ec36eadcb54f375cf3f5e865d4
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -4,8 +4,6 @@
|
|
4
4
|
|
5
5
|
Character conversion from latin to cyrillic and vice versa.
|
6
6
|
|
7
|
-
Please contribute conversion alphabets if yours is missing.
|
8
|
-
|
9
7
|
## INSTALL
|
10
8
|
|
11
9
|
gem install cyrillizer
|
@@ -16,12 +14,18 @@ Please contribute conversion alphabets if yours is missing.
|
|
16
14
|
puts 'kirilica'.to_cyr # => 'кирилица'
|
17
15
|
puts 'латиница'.to_lat # => 'latinica'
|
18
16
|
|
19
|
-
|
17
|
+
Specify conversion language:
|
20
18
|
|
21
19
|
Cyrillizer.language = :russian
|
22
20
|
puts "пульт управления" # => "pul't upravleniya"
|
23
21
|
puts "pul't upravleniya" # => "пульт управления"
|
24
22
|
|
23
|
+
Contribute conversion alphabets if you want yours built into the gem.
|
24
|
+
|
25
|
+
Or use your own custom alphabet:
|
26
|
+
|
27
|
+
Cyrillizer.alphabet = "alphabet/russian.yml" # path to the alphabet
|
28
|
+
|
25
29
|
## TESTS
|
26
30
|
|
27
31
|
bundle install
|
@@ -29,14 +33,13 @@ Or change conversion language:
|
|
29
33
|
|
30
34
|
## CONTRIBUTORS
|
31
35
|
|
32
|
-
|
33
|
-
- Peco Danajlovski ([@Vortex](https://github.com/Vortex))
|
36
|
+
See [contributors](https://github.com/dalibor/cyrillizer/graphs/contributors) list.
|
34
37
|
|
35
38
|
## LICENSE:
|
36
39
|
|
37
40
|
(The MIT License)
|
38
41
|
|
39
|
-
Copyright (c) 2009-
|
42
|
+
Copyright (c) 2009-2015 Dalibor Nasevic
|
40
43
|
|
41
44
|
Permission is hereby granted, free of charge, to any person obtaining
|
42
45
|
a copy of this software and associated documentation files (the
|
data/lib/alphabets/serbian.yml
CHANGED
@@ -5,16 +5,19 @@
|
|
5
5
|
'г': 'g'
|
6
6
|
'џ': 'dž'
|
7
7
|
'д': 'd'
|
8
|
+
'е': 'e'
|
8
9
|
'ђ': 'đ'
|
9
10
|
'ж': 'ž'
|
10
11
|
'з': 'z'
|
11
12
|
'и': 'i'
|
13
|
+
'ј': 'j'
|
12
14
|
'к': 'k'
|
13
15
|
'љ': 'lj'
|
14
16
|
'л': 'l'
|
15
17
|
'м': 'm'
|
16
18
|
'њ': 'nj'
|
17
19
|
'н': 'n'
|
20
|
+
'о': 'o'
|
18
21
|
'п': 'p'
|
19
22
|
'р': 'r'
|
20
23
|
'с': 's'
|
@@ -26,23 +29,29 @@
|
|
26
29
|
'ц': 'c'
|
27
30
|
'ч': 'č'
|
28
31
|
'ш': 'š'
|
32
|
+
'А': 'A'
|
29
33
|
'Б': 'B'
|
30
34
|
'В': 'V'
|
31
35
|
'Г': 'G'
|
32
36
|
'Џ': 'Dž'
|
33
37
|
'Д': 'D'
|
34
38
|
'Ђ': 'Đ'
|
39
|
+
'Е': 'E'
|
35
40
|
'Ж': 'Ž'
|
36
41
|
'З': 'Z'
|
37
42
|
'И': 'I'
|
43
|
+
'Ј': 'J'
|
44
|
+
'К': 'K'
|
38
45
|
'Љ': 'Lj'
|
39
46
|
'Л': 'L'
|
40
47
|
'М': 'M'
|
41
48
|
'Њ': 'Nj'
|
42
49
|
'Н': 'N'
|
50
|
+
'О': 'O'
|
43
51
|
'П': 'P'
|
44
52
|
'Р': 'R'
|
45
53
|
'С': 'S'
|
54
|
+
'Т': 'T'
|
46
55
|
'Ћ': 'Ć'
|
47
56
|
'У': 'U'
|
48
57
|
'Ф': 'F'
|
data/lib/cyrillizer/alphabet.rb
CHANGED
@@ -15,6 +15,13 @@ module Cyrillizer
|
|
15
15
|
@alphabet = nil
|
16
16
|
end
|
17
17
|
|
18
|
+
def alphabet=(file)
|
19
|
+
if file
|
20
|
+
@alphabet = YAML.load_file(file)
|
21
|
+
@language = File.basename(file, File.extname(file))
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
18
25
|
def alphabet
|
19
26
|
@alphabet ||= YAML.load_file(File.join(File.dirname(__FILE__), "../alphabets/#{language.to_s}.yml"))
|
20
27
|
end
|
data/lib/cyrillizer/version.rb
CHANGED
@@ -3,22 +3,18 @@
|
|
3
3
|
require 'spec_helper'
|
4
4
|
|
5
5
|
describe Cyrillizer do
|
6
|
+
after :each do
|
7
|
+
Cyrillizer.language = nil
|
8
|
+
end
|
9
|
+
|
6
10
|
describe ".language" do
|
7
|
-
it "defaults to macedonian" do
|
11
|
+
it "defaults to macedonian language" do
|
8
12
|
Cyrillizer.language.should == :macedonian
|
9
13
|
end
|
10
14
|
end
|
11
15
|
|
12
16
|
describe ".language=" do
|
13
|
-
|
14
|
-
Cyrillizer.language = nil
|
15
|
-
end
|
16
|
-
|
17
|
-
after :each do
|
18
|
-
Cyrillizer.language = nil
|
19
|
-
end
|
20
|
-
|
21
|
-
it "can change language" do
|
17
|
+
it "can specify existing language" do
|
22
18
|
Cyrillizer.language = :russian
|
23
19
|
Cyrillizer.language.should == :russian
|
24
20
|
end
|
@@ -29,4 +25,12 @@ describe Cyrillizer do
|
|
29
25
|
Cyrillizer.alphabet["Џ"].should == "Dzh"
|
30
26
|
end
|
31
27
|
end
|
28
|
+
|
29
|
+
describe ".alphabet=" do
|
30
|
+
it "can set alphabet and language with alphabet file" do
|
31
|
+
Cyrillizer.alphabet = File.join(File.dirname(__FILE__), "../../lib/alphabets/russian.yml")
|
32
|
+
Cyrillizer.alphabet['Щ'].should == "Shch"
|
33
|
+
Cyrillizer.language.should == 'russian'
|
34
|
+
end
|
35
|
+
end
|
32
36
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cyrillizer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dalibor Nasevic
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-08-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|