aloha_analyzer 0.1.7 → 0.1.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/aloha_analyzer/user.rb +10 -10
- data/lib/aloha_analyzer/version.rb +1 -1
- data/lib/aloha_analyzer/yaml/language.yml +1 -1
- data/spec/aloha_analyzer/user_spec.rb +30 -30
- 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: 0acae8c2641f6d9abb0c3eff036d9863851b6e47
|
4
|
+
data.tar.gz: cc9494f19bb86b46feb22ce5aa2412ead5e1851e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 050ee0fd56f108a7acfec808ccc0dbf2bf7262410e59e7c4c3c2222df7dcda6e9ba67ce24e3d600ff36706db12e07eb13acbb348b768eec8313759bf4dba027d
|
7
|
+
data.tar.gz: 790123f96c672f8327c78f646989cb1c1d710e8be2ae805669a38cf56e3f8e31c892095c08c35925f553ed10bbe1fc49357d71a9e7707b2d9c3b5054cacd3e19
|
data/lib/aloha_analyzer/user.rb
CHANGED
@@ -16,20 +16,20 @@ module AlohaAnalyzer
|
|
16
16
|
@users.each do |user|
|
17
17
|
abbreviation = user['lang']
|
18
18
|
if abbreviation == @language
|
19
|
-
analysys[:
|
20
|
-
analysys[:
|
19
|
+
analysys[:account_language][:count] += 1
|
20
|
+
analysys[:account_language][:users].push user
|
21
21
|
else
|
22
|
-
if analysys[:
|
23
|
-
analysys[:
|
24
|
-
analysys[:
|
22
|
+
if analysys[:non_account_languages][abbreviation]
|
23
|
+
analysys[:non_account_languages][abbreviation][:count] += 1
|
24
|
+
analysys[:non_account_languages][abbreviation][:users].push user
|
25
25
|
else
|
26
|
-
analysys[:
|
26
|
+
analysys[:non_account_languages][abbreviation] = {
|
27
27
|
:count => 1,
|
28
28
|
:language => Language.find_by_abbreviation(abbreviation),
|
29
29
|
:users => [user]
|
30
30
|
}
|
31
31
|
end
|
32
|
-
analysys[:
|
32
|
+
analysys[:non_account_languages_count] += 1
|
33
33
|
end
|
34
34
|
analysys[:count] += 1
|
35
35
|
end
|
@@ -41,14 +41,14 @@ module AlohaAnalyzer
|
|
41
41
|
|
42
42
|
def boilerplate_analysis
|
43
43
|
Hash.new.tap do |analysys|
|
44
|
-
analysys[:
|
44
|
+
analysys[:account_language] = {
|
45
45
|
count: 0,
|
46
46
|
language: Language.find_by_abbreviation(@language),
|
47
47
|
users: []
|
48
48
|
}
|
49
|
-
analysys[:
|
49
|
+
analysys[:non_account_languages_count] = 0
|
50
50
|
analysys[:count] = 0
|
51
|
-
analysys[:
|
51
|
+
analysys[:non_account_languages] = Hash.new
|
52
52
|
end
|
53
53
|
end
|
54
54
|
|
@@ -53,17 +53,17 @@ describe AlohaAnalyzer::User do
|
|
53
53
|
end
|
54
54
|
|
55
55
|
it 'has no results with the user language' do
|
56
|
-
subject[:
|
56
|
+
subject[:account_language][:count].should eq 0
|
57
57
|
end
|
58
58
|
|
59
59
|
it 'has no results without the user language' do
|
60
|
-
subject[:
|
61
|
-
subject[:
|
60
|
+
subject[:non_account_languages].should eq({})
|
61
|
+
subject[:non_account_languages_count].should eq 0
|
62
62
|
end
|
63
63
|
|
64
64
|
it 'includes the user lanugage' do
|
65
|
-
subject[:
|
66
|
-
"abbreviation"=>"en", "name"=>"English", "population"=>238000000, "countries"=>"USA,
|
65
|
+
subject[:account_language][:language].should eq(
|
66
|
+
"abbreviation"=>"en", "greeting" => "hello!", "name"=>"English", "population"=>238000000, "countries"=>"USA, UK, Canada, Ireland, Australia"
|
67
67
|
)
|
68
68
|
end
|
69
69
|
end
|
@@ -88,27 +88,27 @@ describe AlohaAnalyzer::User do
|
|
88
88
|
end
|
89
89
|
|
90
90
|
it 'includes the user lanugage' do
|
91
|
-
subject[:
|
91
|
+
subject[:account_language].should eq(
|
92
92
|
:count => 2,
|
93
|
-
:language => {'abbreviation'=>'en', 'name'=>'English', 'population'=>238000000, "countries"=>"USA,
|
93
|
+
:language => {'abbreviation'=>'en', 'name'=>'English', 'population'=>238000000, "countries"=>"USA, UK, Canada, Ireland, Australia", "greeting"=>"hello!"},
|
94
94
|
:users => [{'id' => '1', 'lang' => 'en'}, {'id' => '3', 'lang' => 'en'}]
|
95
95
|
)
|
96
96
|
end
|
97
97
|
|
98
98
|
it 'includs the foreign followers count' do
|
99
|
-
subject[:
|
99
|
+
subject[:non_account_languages_count].should eq 2
|
100
100
|
end
|
101
101
|
|
102
102
|
it 'returns results based on the user language' do
|
103
|
-
subject[:
|
103
|
+
subject[:non_account_languages].should == {
|
104
104
|
'fr' => {
|
105
105
|
count: 1,
|
106
|
-
language: {'abbreviation'=>'fr', 'name'=>'French', 'population'=>14000000, "countries"=>"France, Canada, Belgium, Switzerland"},
|
106
|
+
language: {'abbreviation'=>'fr', 'name'=>'French', "greeting"=>"bonjour!", 'population'=>14000000, "countries"=>"France, Canada, Belgium, Switzerland"},
|
107
107
|
users: [{'id' => '2', 'lang' => 'fr'}]
|
108
108
|
},
|
109
109
|
'de' => {
|
110
110
|
count: 1,
|
111
|
-
language: {'abbreviation'=>'de', 'name'=>'German', 'population'=>5000000, "countries"=>"Germany, Austria, Switzerland, Belgium"},
|
111
|
+
language: {'abbreviation'=>'de', 'name'=>'German', "greeting"=>"hallo!", 'population'=>5000000, "countries"=>"Germany, Austria, Switzerland, Belgium"},
|
112
112
|
users: [{'id' => '4', 'lang' => 'de'}]
|
113
113
|
}
|
114
114
|
}
|
@@ -132,22 +132,22 @@ describe AlohaAnalyzer::User do
|
|
132
132
|
end
|
133
133
|
|
134
134
|
it 'includes the user lanugage' do
|
135
|
-
subject[:
|
136
|
-
"abbreviation"=>"en", "name"=>"English", "population"=>238000000, "countries"=>"USA,
|
135
|
+
subject[:account_language][:language].should eq(
|
136
|
+
"abbreviation"=>"en", "greeting" => "hello!", "name"=>"English", "population"=>238000000, "countries"=>"USA, UK, Canada, Ireland, Australia"
|
137
137
|
)
|
138
138
|
end
|
139
139
|
|
140
140
|
it 'returns results based on the user language' do
|
141
|
-
subject[:
|
141
|
+
subject[:account_language].should == {
|
142
142
|
:count => 2,
|
143
|
-
:language => {'abbreviation'=>'en', 'name'=>'English', 'population'=>238000000, 'countries' => 'USA,
|
143
|
+
:language => {'abbreviation'=>'en', 'name'=>'English', 'population'=>238000000, 'countries' => 'USA, UK, Canada, Ireland, Australia', "greeting"=>"hello!"},
|
144
144
|
:users => [{'id' => '1', 'lang' => 'en'}, {'id' => '2', 'lang' => 'en'}]
|
145
145
|
}
|
146
146
|
end
|
147
147
|
|
148
148
|
it 'returns results results based on the non user language' do
|
149
|
-
subject[:
|
150
|
-
subject[:
|
149
|
+
subject[:non_account_languages].should == {}
|
150
|
+
subject[:non_account_languages_count].should eq 0
|
151
151
|
end
|
152
152
|
end
|
153
153
|
|
@@ -169,27 +169,27 @@ describe AlohaAnalyzer::User do
|
|
169
169
|
end
|
170
170
|
|
171
171
|
it 'returns results based on the user language' do
|
172
|
-
subject[:
|
172
|
+
subject[:account_language].should == {
|
173
173
|
:count => 0,
|
174
|
-
:language => {"abbreviation"=>"en", "name"=>"English", "population"=>238000000, "countries"=>"USA,
|
174
|
+
:language => {"abbreviation"=>"en", "greeting" => "hello!", "name"=>"English", "population"=>238000000, "countries"=>"USA, UK, Canada, Ireland, Australia"},
|
175
175
|
:users => []
|
176
176
|
}
|
177
177
|
end
|
178
178
|
|
179
|
-
it 'includes the correct
|
180
|
-
subject[:
|
179
|
+
it 'includes the correct non_account_languages_count' do
|
180
|
+
subject[:non_account_languages_count].should eq 3
|
181
181
|
end
|
182
182
|
|
183
183
|
it 'returns results results based on the non user language' do
|
184
|
-
subject[:
|
184
|
+
subject[:non_account_languages].should eq(
|
185
185
|
'fr' => {
|
186
186
|
:count => 2,
|
187
|
-
:language => { 'abbreviation'=>'fr', 'name'=>'French', 'population'=>14000000, 'countries' => 'France, Canada, Belgium, Switzerland' },
|
187
|
+
:language => { 'abbreviation'=>'fr', 'name'=>'French', "greeting"=>"bonjour!", 'population'=>14000000, 'countries' => 'France, Canada, Belgium, Switzerland' },
|
188
188
|
:users => [{'id' => '2', 'lang' => 'fr'}, {'id' => '3', 'lang' => 'fr'}]
|
189
189
|
},
|
190
190
|
'de' => {
|
191
191
|
:count => 1,
|
192
|
-
:language => {'abbreviation'=>'de', 'name'=>'German', 'population'=>5000000, 'countries' => 'Germany, Austria, Switzerland, Belgium' },
|
192
|
+
:language => {'abbreviation'=>'de', 'name'=>'German', "greeting"=>"hallo!", 'population'=>5000000, 'countries' => 'Germany, Austria, Switzerland, Belgium' },
|
193
193
|
:users => [{'id' => '1', 'lang' => 'de'}]
|
194
194
|
}
|
195
195
|
)
|
@@ -210,22 +210,22 @@ describe AlohaAnalyzer::User do
|
|
210
210
|
end
|
211
211
|
|
212
212
|
it 'includes the user lanugage' do
|
213
|
-
subject[:
|
213
|
+
subject[:account_language].should == {
|
214
214
|
:count => 2,
|
215
|
-
:language => { "abbreviation"=>"en", "name"=>"English", "population"=>238000000, "countries"=>"USA,
|
215
|
+
:language => { "abbreviation"=>"en", "greeting" => "hello!", "name"=>"English", "population"=>238000000, "countries"=>"USA, UK, Canada, Ireland, Australia" },
|
216
216
|
:users => [{'id' => '1', 'lang' => 'en'}, {'id' => '3', 'lang' => 'en'}]
|
217
217
|
}
|
218
218
|
end
|
219
219
|
|
220
|
-
it 'includes the correct
|
221
|
-
subject[:
|
220
|
+
it 'includes the correct non_account_languages_count' do
|
221
|
+
subject[:non_account_languages_count].should eq 1
|
222
222
|
end
|
223
223
|
|
224
224
|
it 'merges english and british' do
|
225
|
-
subject[:
|
225
|
+
subject[:non_account_languages].should eq(
|
226
226
|
'fr' => {
|
227
227
|
:count => 1,
|
228
|
-
:language => {'abbreviation'=>'fr', 'name'=>'French', 'population'=>14000000, 'countries' => 'France, Canada, Belgium, Switzerland'},
|
228
|
+
:language => {'abbreviation'=>'fr', 'name'=>'French', "greeting"=>"bonjour!", 'population'=>14000000, 'countries' => 'France, Canada, Belgium, Switzerland'},
|
229
229
|
:users => [{'id' => '2', 'lang' => 'fr'}]
|
230
230
|
}
|
231
231
|
)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: aloha_analyzer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matthieu Aussaguel
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-05-
|
11
|
+
date: 2014-05-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|