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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3f117016e6b3389f49f4574cbf168e32e9f2a773
4
- data.tar.gz: 65bc0d3df3d335a06bb7a49ea01f5d413c9f23d2
3
+ metadata.gz: f132b629cde031661956744828cf17ff8bdc6905
4
+ data.tar.gz: 18b3b6fad6d9169f3125b82bbcba735e402ba3e4
5
5
  SHA512:
6
- metadata.gz: a2c417167c522e2ebe587df56f31a84630c7eb058bfe427026c0a644c781f4faa0b42f97b320c273fbf785df8c0c0f2ec9bf0219ad81b85e5218b520a3080fea
7
- data.tar.gz: d9aaa1eff3d84115cad39e6901b501f7859d4119ae6e675ea17203a3bef9c49f27dd07bcd3bb6ce719c836ea2fd889669ed09723c264f6bdfb4a448f928c142c
6
+ metadata.gz: 4338533f55604dfb3145b03938539fe1b4ea52887ceafa57ea66e3efb8726092d2fd10c404250a68edf46f5bf19e4412ad3a48c62f7e3b644665e158e275fcc1
7
+ data.tar.gz: 6b8ea46c48daddda0df3295e66017f2ea0e1c5f4a729199f48f9a36d0b8289c8c69af93e5ae74fac8e13cea3c05c50e50e1d79ec36eadcb54f375cf3f5e865d4
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- cyrillizer (0.2.0)
4
+ cyrillizer (0.2.1)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
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
- Or change conversion language:
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
- - Vitaly Zemlyansky ([@vzemlyansky](https://github.com/vzemlyansky))
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-2013 Dalibor Nasevic
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
@@ -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'
@@ -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
@@ -1,3 +1,3 @@
1
1
  module Cyrillizer
2
- VERSION = "0.2.1"
2
+ VERSION = "0.2.2"
3
3
  end
@@ -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
- before :each do
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.1
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-07-26 00:00:00.000000000 Z
11
+ date: 2015-08-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec