aloha_analyzer 0.0.8 → 0.0.9
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 +5 -5
- data/lib/aloha_analyzer/version.rb +1 -1
- data/lib/aloha_analyzer/yaml/language.yml +2 -2
- data/spec/aloha_analyzer/user_spec.rb +17 -17
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4412c824606b189b364a805aab7706f1c8dac27b
|
4
|
+
data.tar.gz: ec9d793acc71096a2699063d4d5e0eb3a6e581a9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fa607f08ff5a4d3833676d8c10746b46b6df2782e23a4a0ff69a996f0a3a8776cba007926b480f5b11ea82363b5fececc24eb982920fb37e81393ac860cf3b25
|
7
|
+
data.tar.gz: 2c98161a65f1fddb61123252b618c040e527bdf64e2d2e228c612981dcb6d2024c0f1db242b29de24fba367034f8c4749106157cf0a03bc76da99a60d1c15af9
|
data/lib/aloha_analyzer/user.rb
CHANGED
@@ -4,7 +4,7 @@ module AlohaAnalyzer
|
|
4
4
|
attr_reader :language
|
5
5
|
|
6
6
|
def initialize(language, users)
|
7
|
-
@language = language
|
7
|
+
@language = language.downcase
|
8
8
|
@users = users
|
9
9
|
@users_count = users.size
|
10
10
|
clean_language!
|
@@ -29,7 +29,7 @@ module AlohaAnalyzer
|
|
29
29
|
else
|
30
30
|
languages[abbreviation] = {
|
31
31
|
'count' => 1,
|
32
|
-
'
|
32
|
+
'language' => Language.find_by_abbreviation(abbreviation)
|
33
33
|
}
|
34
34
|
end
|
35
35
|
languages[abbreviation]['percentage'] = ((100 / @users_count.to_f) * languages[abbreviation]['count']).round
|
@@ -47,7 +47,7 @@ module AlohaAnalyzer
|
|
47
47
|
else
|
48
48
|
languages[abbreviation] = {
|
49
49
|
'count' => 1,
|
50
|
-
'
|
50
|
+
'language' => Language.find_by_abbreviation(abbreviation)
|
51
51
|
}
|
52
52
|
end
|
53
53
|
languages[abbreviation]['percentage'] = ((100 / users_total_without_user_language.to_f) * languages[abbreviation]['count']).round
|
@@ -76,8 +76,8 @@ module AlohaAnalyzer
|
|
76
76
|
|
77
77
|
def clean_users_languages!
|
78
78
|
@users.map! do |user|
|
79
|
-
if Language.aliases.keys.include?(user['lang'])
|
80
|
-
user['lang'] = Language.aliases[user['lang']]
|
79
|
+
if Language.aliases.keys.include?(user['lang'].downcase)
|
80
|
+
user['lang'] = Language.aliases[user['lang'].downcase]
|
81
81
|
end
|
82
82
|
user
|
83
83
|
end
|
@@ -14,7 +14,7 @@
|
|
14
14
|
name: Spanish
|
15
15
|
population: 95_000_000
|
16
16
|
- abbreviation: de
|
17
|
-
name:
|
17
|
+
name: German
|
18
18
|
population: 5_000_000
|
19
19
|
- abbreviation: it
|
20
20
|
name: Italian
|
@@ -38,7 +38,7 @@
|
|
38
38
|
name: Dutch
|
39
39
|
population: 8_000_000
|
40
40
|
- abbreviation: fil
|
41
|
-
name:
|
41
|
+
name: Tagalog
|
42
42
|
population: 8_000_000
|
43
43
|
- abbreviation: msa
|
44
44
|
name: Malay
|
@@ -77,17 +77,17 @@ describe AlohaAnalyzer::User do
|
|
77
77
|
'en' => {
|
78
78
|
'percentage' => 50,
|
79
79
|
'count' => 2,
|
80
|
-
'
|
80
|
+
'language' => {'abbreviation'=>'en', 'name'=>'English', 'population'=>238000000},
|
81
81
|
},
|
82
82
|
'fr' => {
|
83
83
|
'percentage' => 25,
|
84
84
|
'count' => 1,
|
85
|
-
'
|
85
|
+
'language' => {'abbreviation'=>'fr', 'name'=>'French', 'population'=>14000000},
|
86
86
|
},
|
87
87
|
'de' => {
|
88
88
|
'percentage' => 25,
|
89
89
|
'count' => 1,
|
90
|
-
'
|
90
|
+
'language' => {'abbreviation'=>'de', 'name'=>'German', 'population'=>5000000}
|
91
91
|
}
|
92
92
|
}
|
93
93
|
end
|
@@ -97,12 +97,12 @@ describe AlohaAnalyzer::User do
|
|
97
97
|
'fr' => {
|
98
98
|
'percentage' => 50,
|
99
99
|
'count' => 1,
|
100
|
-
'
|
100
|
+
'language' => {'abbreviation'=>'fr', 'name'=>'French', 'population'=>14000000},
|
101
101
|
},
|
102
102
|
'de' => {
|
103
103
|
'percentage' => 50,
|
104
104
|
'count' => 1,
|
105
|
-
'
|
105
|
+
'language' => {'abbreviation'=>'de', 'name'=>'German', 'population'=>5000000}
|
106
106
|
}
|
107
107
|
)
|
108
108
|
end
|
@@ -125,7 +125,7 @@ describe AlohaAnalyzer::User do
|
|
125
125
|
'en' => {
|
126
126
|
'percentage' => 100,
|
127
127
|
'count' => 2,
|
128
|
-
'
|
128
|
+
'language' => {'abbreviation'=>'en', 'name'=>'English', 'population'=>238000000},
|
129
129
|
}
|
130
130
|
}
|
131
131
|
end
|
@@ -152,12 +152,12 @@ describe AlohaAnalyzer::User do
|
|
152
152
|
'fr' => {
|
153
153
|
'percentage' => 50,
|
154
154
|
'count' => 1,
|
155
|
-
'
|
155
|
+
'language' => {'abbreviation'=>'fr', 'name'=>'French', 'population'=>14000000},
|
156
156
|
},
|
157
157
|
'de' => {
|
158
158
|
'percentage' => 50,
|
159
159
|
'count' => 1,
|
160
|
-
'
|
160
|
+
'language' => {'abbreviation'=>'de', 'name'=>'German', 'population'=>5000000}
|
161
161
|
}
|
162
162
|
}
|
163
163
|
end
|
@@ -167,12 +167,12 @@ describe AlohaAnalyzer::User do
|
|
167
167
|
'fr' => {
|
168
168
|
'percentage' => 50,
|
169
169
|
'count' => 1,
|
170
|
-
'
|
170
|
+
'language' => { 'abbreviation'=>'fr', 'name'=>'French', 'population'=>14000000 },
|
171
171
|
},
|
172
172
|
'de' => {
|
173
173
|
'percentage' => 50,
|
174
174
|
'count' => 1,
|
175
|
-
'
|
175
|
+
'language' => {'abbreviation'=>'de', 'name'=>'German', 'population'=>5000000}
|
176
176
|
}
|
177
177
|
)
|
178
178
|
end
|
@@ -184,7 +184,7 @@ describe AlohaAnalyzer::User do
|
|
184
184
|
[
|
185
185
|
{'lang' => 'en'},
|
186
186
|
{'lang' => 'fr'},
|
187
|
-
{'lang' => 'en-
|
187
|
+
{'lang' => 'en-GB'}
|
188
188
|
]
|
189
189
|
}
|
190
190
|
|
@@ -193,12 +193,12 @@ describe AlohaAnalyzer::User do
|
|
193
193
|
'en' => {
|
194
194
|
'percentage' => 67,
|
195
195
|
'count' => 2,
|
196
|
-
'
|
196
|
+
'language'=>{'abbreviation'=>'en', 'name'=>'English', 'population'=>238000000},
|
197
197
|
},
|
198
198
|
'fr' => {
|
199
199
|
'percentage' => 33,
|
200
200
|
'count' => 1,
|
201
|
-
'
|
201
|
+
'language' => {'abbreviation'=>'fr', 'name'=>'French', 'population'=>14000000}
|
202
202
|
}
|
203
203
|
}
|
204
204
|
|
@@ -206,7 +206,7 @@ describe AlohaAnalyzer::User do
|
|
206
206
|
'fr' => {
|
207
207
|
'percentage' => 100,
|
208
208
|
'count' => 1,
|
209
|
-
'
|
209
|
+
'language' => {'abbreviation'=>'fr', 'name'=>'French', 'population'=>14000000}
|
210
210
|
}
|
211
211
|
)
|
212
212
|
end
|
@@ -227,12 +227,12 @@ describe AlohaAnalyzer::User do
|
|
227
227
|
'zh' => {
|
228
228
|
'percentage' => 75,
|
229
229
|
'count' => 3,
|
230
|
-
'
|
230
|
+
'language'=>{'abbreviation'=>'zh', 'name'=>'Chinese', 'population'=>20000}
|
231
231
|
},
|
232
232
|
'en' => {
|
233
233
|
'percentage' => 25,
|
234
234
|
'count' => 1,
|
235
|
-
'
|
235
|
+
'language'=>{'abbreviation'=>'en', 'name'=>'English', 'population'=>238000000}
|
236
236
|
}
|
237
237
|
}
|
238
238
|
|
@@ -240,7 +240,7 @@ describe AlohaAnalyzer::User do
|
|
240
240
|
'zh' => {
|
241
241
|
'percentage' => 100,
|
242
242
|
'count' => 3,
|
243
|
-
'
|
243
|
+
'language'=>{'abbreviation'=>'zh', 'name'=>'Chinese', 'population'=>20000}
|
244
244
|
}
|
245
245
|
)
|
246
246
|
end
|