male_or_female 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +3 -1
- data/lib/male_or_female/version.rb +1 -1
- data/lib/male_or_female.rb +1 -4
- data/test/test_female_informal.rb +1 -1
- metadata +3 -3
data/README.md
CHANGED
@@ -1,9 +1,11 @@
|
|
1
1
|
![MaleOrFemale](https://raw.github.com/shlima/MaleOrFemale/master/doc/logo.png)
|
2
2
|
|
3
|
-
|
3
|
+
_MaleOrFemale_ - gem для определения пола человека (male, female, unisex) по его имени. Гем также определяет тип имени (официальное или неформальное).
|
4
4
|
|
5
5
|
Демонстрация работы: http://typograf.herokuapp.com/gender
|
6
6
|
|
7
|
+
**На данный момент гем определяет только русскоязычные имена**
|
8
|
+
|
7
9
|
## Использование
|
8
10
|
|
9
11
|
require 'male_or_female'
|
data/lib/male_or_female.rb
CHANGED
@@ -6,9 +6,6 @@ require 'yaml'
|
|
6
6
|
|
7
7
|
module MaleOrFemale
|
8
8
|
|
9
|
-
#COMPILED_DIR = './lib/male_or_female/data_compiled'
|
10
|
-
#SOURCE_DIR = './lib/male_or_female/data_source'
|
11
|
-
|
12
9
|
COMPILED_DIR = File.expand_path('../male_or_female/data_compiled', __FILE__)
|
13
10
|
SOURCE_DIR = File.expand_path('../male_or_female/data_source', __FILE__)
|
14
11
|
|
@@ -21,7 +18,7 @@ module MaleOrFemale
|
|
21
18
|
|
22
19
|
class Detector
|
23
20
|
def initialize(name, options = {})
|
24
|
-
source = options[:source] || '
|
21
|
+
source = options[:source] || 'compiled'
|
25
22
|
@name = prepare_name(name)
|
26
23
|
@data = load_data(@name[0], source.to_sym)
|
27
24
|
@result = detect
|
@@ -15,7 +15,7 @@ class FemaleInformalTest < Test::Unit::TestCase
|
|
15
15
|
end
|
16
16
|
|
17
17
|
def test_l
|
18
|
-
name = MaleOrFemale::Detector.new('
|
18
|
+
name = MaleOrFemale::Detector.new('валя')
|
19
19
|
name_should = MaleOrFemale::FEMALE
|
20
20
|
assert_equal name.gender, name_should
|
21
21
|
assert_equal name.format, FORMAT_SHOULD
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: male_or_female
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -144,7 +144,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
144
144
|
version: '0'
|
145
145
|
segments:
|
146
146
|
- 0
|
147
|
-
hash: -
|
147
|
+
hash: -230927073037497391
|
148
148
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
149
149
|
none: false
|
150
150
|
requirements:
|
@@ -153,7 +153,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
153
153
|
version: '0'
|
154
154
|
segments:
|
155
155
|
- 0
|
156
|
-
hash: -
|
156
|
+
hash: -230927073037497391
|
157
157
|
requirements: []
|
158
158
|
rubyforge_project:
|
159
159
|
rubygems_version: 1.8.25
|