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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a3be59ca9132df26ff01c1c7680b73be2593435a
4
- data.tar.gz: 7c98f9d0d933131904c3790489efa99a7c1409aa
3
+ metadata.gz: 4412c824606b189b364a805aab7706f1c8dac27b
4
+ data.tar.gz: ec9d793acc71096a2699063d4d5e0eb3a6e581a9
5
5
  SHA512:
6
- metadata.gz: d1cd7f51fb8cbfbaa19038881c6413d98a9e563a9e24933952d487760ba9817eafa096090eb75cf66b9f13bce574a48fd809c9b2351e53a5f7b778c9dc0829dd
7
- data.tar.gz: 521047abe7d465ac69dc7b65ccd613cdcbe7d6a537367d40214c36166f04bb882c604c2410e63b544d8628383af0ed81e421b8c1fc904feac93993a9134b73a3
6
+ metadata.gz: fa607f08ff5a4d3833676d8c10746b46b6df2782e23a4a0ff69a996f0a3a8776cba007926b480f5b11ea82363b5fececc24eb982920fb37e81393ac860cf3b25
7
+ data.tar.gz: 2c98161a65f1fddb61123252b618c040e527bdf64e2d2e228c612981dcb6d2024c0f1db242b29de24fba367034f8c4749106157cf0a03bc76da99a60d1c15af9
@@ -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
- 'population' => Language.find_by_abbreviation(abbreviation)['population']
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
- 'population' => Language.find_by_abbreviation(abbreviation)['population']
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
@@ -1,3 +1,3 @@
1
1
  module AlohaAnalyzer
2
- VERSION = '0.0.8'
2
+ VERSION = '0.0.9'
3
3
  end
@@ -14,7 +14,7 @@
14
14
  name: Spanish
15
15
  population: 95_000_000
16
16
  - abbreviation: de
17
- name: 'German'
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: Filipino
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
- 'population' => 238_000_000,
80
+ 'language' => {'abbreviation'=>'en', 'name'=>'English', 'population'=>238000000},
81
81
  },
82
82
  'fr' => {
83
83
  'percentage' => 25,
84
84
  'count' => 1,
85
- 'population' => 14_000_000,
85
+ 'language' => {'abbreviation'=>'fr', 'name'=>'French', 'population'=>14000000},
86
86
  },
87
87
  'de' => {
88
88
  'percentage' => 25,
89
89
  'count' => 1,
90
- 'population' => 5_000_000,
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
- 'population' => 14_000_000,
100
+ 'language' => {'abbreviation'=>'fr', 'name'=>'French', 'population'=>14000000},
101
101
  },
102
102
  'de' => {
103
103
  'percentage' => 50,
104
104
  'count' => 1,
105
- 'population' => 5_000_000,
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
- 'population' => 238_000_000,
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
- 'population' => 14_000_000,
155
+ 'language' => {'abbreviation'=>'fr', 'name'=>'French', 'population'=>14000000},
156
156
  },
157
157
  'de' => {
158
158
  'percentage' => 50,
159
159
  'count' => 1,
160
- 'population' => 5_000_000,
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
- 'population' => 14_000_000,
170
+ 'language' => { 'abbreviation'=>'fr', 'name'=>'French', 'population'=>14000000 },
171
171
  },
172
172
  'de' => {
173
173
  'percentage' => 50,
174
174
  'count' => 1,
175
- 'population' => 5_000_000,
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-gb'}
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
- 'population' => 238_000_000,
196
+ 'language'=>{'abbreviation'=>'en', 'name'=>'English', 'population'=>238000000},
197
197
  },
198
198
  'fr' => {
199
199
  'percentage' => 33,
200
200
  'count' => 1,
201
- 'population' => 14_000_000
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
- 'population' => 14_000_000
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
- 'population' => 20000,
230
+ 'language'=>{'abbreviation'=>'zh', 'name'=>'Chinese', 'population'=>20000}
231
231
  },
232
232
  'en' => {
233
233
  'percentage' => 25,
234
234
  'count' => 1,
235
- 'population' => 238000000
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
- 'population' => 20000
243
+ 'language'=>{'abbreviation'=>'zh', 'name'=>'Chinese', 'population'=>20000}
244
244
  }
245
245
  )
246
246
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aloha_analyzer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matthieu Aussaguel