gendered 0.0.5 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/gendered/guesser.rb +7 -2
- data/lib/gendered/version.rb +1 -1
- data/spec/lib/gendered/guesser_spec.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 45dd165cc82b4c0d37492943c3e0b404df8a8001
|
4
|
+
data.tar.gz: 2dfab03e1dcf771e14e25ed8addc0db487ceb746
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ad9be58b9a724ec1d1bdbbc02b6b1ea0d97b433b9fc09bfc8d47afa5fc014cfaea1c473a83065dafe2ce3606e26fd85239d65a4e66f6cedd64d61aaf029abd75
|
7
|
+
data.tar.gz: afe8c2d93528556df06443068e38b537c2641bfe411fe1250facea51547523294a0415670119daccbd66429ac34a171f17f4384118f285efce1ce351457446f5
|
data/lib/gendered/guesser.rb
CHANGED
@@ -20,7 +20,12 @@ module Gendered
|
|
20
20
|
names.collect do |name|
|
21
21
|
name = Name.new(name) if name.is_a?(String)
|
22
22
|
|
23
|
-
guess =
|
23
|
+
guess = case
|
24
|
+
when guesses.is_a?(Array)
|
25
|
+
guesses.find { |g| g["name"] == name.value }
|
26
|
+
else
|
27
|
+
guesses
|
28
|
+
end
|
24
29
|
|
25
30
|
if guess["gender"]
|
26
31
|
name.gender = guess["gender"].to_sym
|
@@ -34,7 +39,7 @@ module Gendered
|
|
34
39
|
end
|
35
40
|
|
36
41
|
def url
|
37
|
-
url = "
|
42
|
+
url = "https://api.genderize.io/?"
|
38
43
|
url += "country_id=#{country_id}&" if country_id
|
39
44
|
|
40
45
|
name_queries = names.collect.with_index do |name, index|
|
data/lib/gendered/version.rb
CHANGED
@@ -19,7 +19,7 @@ module Gendered
|
|
19
19
|
end
|
20
20
|
|
21
21
|
it "creates the correct url" do
|
22
|
-
expect(subject.url).to eq "
|
22
|
+
expect(subject.url).to eq "https://api.genderize.io/?name[0]=Sean&name[1]=Theresa"
|
23
23
|
end
|
24
24
|
|
25
25
|
it "cannot be initialized with an empty array" do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gendered
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sean Devine
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-02-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: http
|
@@ -124,3 +124,4 @@ test_files:
|
|
124
124
|
- spec/lib/gendered/name_list_spec.rb
|
125
125
|
- spec/lib/gendered/name_spec.rb
|
126
126
|
- spec/spec_helper.rb
|
127
|
+
has_rdoc:
|