petrovich 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +8 -0
- data/lib/petrovich.rb +1 -1
- data/lib/petrovich/rules.rb +2 -2
- metadata +8 -56
data/README.md
CHANGED
@@ -124,6 +124,14 @@ person.name_dative # => Ивану
|
|
124
124
|
|
125
125
|
Если вы хотите помочь этому проекту, вы можете реализовать любой план из перечисленных выше. Но прежде свяжитесь с разработчиками, чтобы ваши и наши планы не пересекались.
|
126
126
|
|
127
|
+
## Тестирование
|
128
|
+
|
129
|
+
Чтобы запустить тесты, тестирующие фамилии, нужно установить `ENV` переменную:
|
130
|
+
|
131
|
+
```
|
132
|
+
TEST_SURNAMES=1 rspec
|
133
|
+
```
|
134
|
+
|
127
135
|
## Содействие
|
128
136
|
|
129
137
|
Если вы нашли баги, как программной части, так и в словаре, вы всегда можете форкнуть репозиторий и внести необходимые правки. Ваша помощь не останется незамеченной. Если вы заметили ошибки при склонении падежей имён, фамилий или отчеств, можете написать об этом в issues. Проблема будет сразу же исследована и решена.
|
data/lib/petrovich.rb
CHANGED
data/lib/petrovich/rules.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
|
1
|
+
# encoding: utf-8
|
2
2
|
|
3
3
|
class Petrovich
|
4
4
|
# Загрузка правил происходит один раз
|
@@ -30,7 +30,7 @@ class Petrovich
|
|
30
30
|
def match?(name, rule, match_whole_word)
|
31
31
|
return false if rule['gender'] == 'male' && female? || rule['gender'] == 'female' && !female?
|
32
32
|
|
33
|
-
name =
|
33
|
+
name = UnicodeUtils.downcase(name)
|
34
34
|
rule['test'].each do |chars|
|
35
35
|
test = match_whole_word ? name : name.slice([name.size - chars.size, 0].max .. -1)
|
36
36
|
return true if test == chars
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: petrovich
|
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,40 +9,24 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-04-
|
12
|
+
date: 2013-04-22 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
|
-
name:
|
15
|
+
name: unicode_utils
|
16
16
|
requirement: !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
|
-
- -
|
20
|
-
- !ruby/object:Gem::Version
|
21
|
-
version: 0.6.4
|
22
|
-
type: :runtime
|
23
|
-
prerelease: false
|
24
|
-
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
|
-
requirements:
|
27
|
-
- - ! '>='
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
version: 0.6.4
|
30
|
-
- !ruby/object:Gem::Dependency
|
31
|
-
name: activesupport
|
32
|
-
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
|
-
requirements:
|
35
|
-
- - ! '>='
|
19
|
+
- - '='
|
36
20
|
- !ruby/object:Gem::Version
|
37
|
-
version:
|
21
|
+
version: 1.4.0
|
38
22
|
type: :runtime
|
39
23
|
prerelease: false
|
40
24
|
version_requirements: !ruby/object:Gem::Requirement
|
41
25
|
none: false
|
42
26
|
requirements:
|
43
|
-
- -
|
27
|
+
- - '='
|
44
28
|
- !ruby/object:Gem::Version
|
45
|
-
version:
|
29
|
+
version: 1.4.0
|
46
30
|
- !ruby/object:Gem::Dependency
|
47
31
|
name: rspec
|
48
32
|
requirement: !ruby/object:Gem::Requirement
|
@@ -59,38 +43,6 @@ dependencies:
|
|
59
43
|
- - ! '>='
|
60
44
|
- !ruby/object:Gem::Version
|
61
45
|
version: '0'
|
62
|
-
- !ruby/object:Gem::Dependency
|
63
|
-
name: sqlite3
|
64
|
-
requirement: !ruby/object:Gem::Requirement
|
65
|
-
none: false
|
66
|
-
requirements:
|
67
|
-
- - ! '>='
|
68
|
-
- !ruby/object:Gem::Version
|
69
|
-
version: '0'
|
70
|
-
type: :development
|
71
|
-
prerelease: false
|
72
|
-
version_requirements: !ruby/object:Gem::Requirement
|
73
|
-
none: false
|
74
|
-
requirements:
|
75
|
-
- - ! '>='
|
76
|
-
- !ruby/object:Gem::Version
|
77
|
-
version: '0'
|
78
|
-
- !ruby/object:Gem::Dependency
|
79
|
-
name: activerecord
|
80
|
-
requirement: !ruby/object:Gem::Requirement
|
81
|
-
none: false
|
82
|
-
requirements:
|
83
|
-
- - ! '>='
|
84
|
-
- !ruby/object:Gem::Version
|
85
|
-
version: 3.2.12
|
86
|
-
type: :development
|
87
|
-
prerelease: false
|
88
|
-
version_requirements: !ruby/object:Gem::Requirement
|
89
|
-
none: false
|
90
|
-
requirements:
|
91
|
-
- - ! '>='
|
92
|
-
- !ruby/object:Gem::Version
|
93
|
-
version: 3.2.12
|
94
46
|
- !ruby/object:Gem::Dependency
|
95
47
|
name: gem-release
|
96
48
|
requirement: !ruby/object:Gem::Requirement
|
@@ -122,7 +74,7 @@ files:
|
|
122
74
|
- MIT-LICENSE
|
123
75
|
- Rakefile
|
124
76
|
- README.md
|
125
|
-
homepage: https://github.com/
|
77
|
+
homepage: https://github.com/rocsci/petrovich
|
126
78
|
licenses: []
|
127
79
|
post_install_message:
|
128
80
|
rdoc_options: []
|