aloha_analyzer 0.3.0 → 0.3.1
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 +14 -14
- data/lib/aloha_analyzer/version.rb +1 -1
- data/spec/aloha_analyzer/user_spec.rb +17 -1
- 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: 81caaf5420375cdbb424f316716b7789ffa83138
|
4
|
+
data.tar.gz: 5f267b646594467a59facb34c9787b20819f3325
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 45fd99434b3e05ddabc6b8a9a722421789459be9154d249d1b4909bad1b370bc3b1e9fac8f390e241261f8571eb24cfa6728dcbb85cca6f97703cf45d79a520f
|
7
|
+
data.tar.gz: 8de8bd977aa9179de77d1b7d38f362088a1f42ed0984168566440fcd18ff7ff2d58eaf8a692c8e5574cd6f789dd3dea56a2dbd2a0ef4bf4ac045aaf2f258c81a
|
data/lib/aloha_analyzer/user.rb
CHANGED
@@ -6,7 +6,7 @@ module AlohaAnalyzer
|
|
6
6
|
def initialize(options)
|
7
7
|
@language = clean_language(options['language'].downcase)
|
8
8
|
@users = clean_users(options['users'])
|
9
|
-
@analysis = options['analysis'] || boilerplate
|
9
|
+
@analysis = (options['analysis'] || boilerplate).clone
|
10
10
|
@options = options
|
11
11
|
end
|
12
12
|
|
@@ -24,6 +24,19 @@ module AlohaAnalyzer
|
|
24
24
|
@analysis
|
25
25
|
end
|
26
26
|
|
27
|
+
def boilerplate
|
28
|
+
{
|
29
|
+
'account_language' => {
|
30
|
+
'count' => 0,
|
31
|
+
'language' => Language.find_by_abbreviation(@language),
|
32
|
+
'users' => []
|
33
|
+
},
|
34
|
+
'foreign_languages_count' => 0,
|
35
|
+
'count' => 0,
|
36
|
+
'foreign_languages' => {}
|
37
|
+
}
|
38
|
+
end
|
39
|
+
|
27
40
|
private
|
28
41
|
|
29
42
|
def add_account_language_user(user)
|
@@ -50,19 +63,6 @@ module AlohaAnalyzer
|
|
50
63
|
end
|
51
64
|
end
|
52
65
|
|
53
|
-
def boilerplate
|
54
|
-
{
|
55
|
-
'account_language' => {
|
56
|
-
'count' => 0,
|
57
|
-
'language' => Language.find_by_abbreviation(@language),
|
58
|
-
'users' => []
|
59
|
-
},
|
60
|
-
'foreign_languages_count' => 0,
|
61
|
-
'count' => 0,
|
62
|
-
'foreign_languages' => {}
|
63
|
-
}
|
64
|
-
end
|
65
|
-
|
66
66
|
def too_many_users?(users)
|
67
67
|
if @options['max_users'] && users.size >= @options['max_users']
|
68
68
|
true
|
@@ -40,11 +40,27 @@ describe AlohaAnalyzer::User do
|
|
40
40
|
end
|
41
41
|
|
42
42
|
context 'when analysis is not nil' do
|
43
|
-
let(:analysis) {
|
43
|
+
let(:analysis) { { foo: :bar } }
|
44
44
|
|
45
45
|
it 'sets the analysis to the argument' do
|
46
46
|
subject.analysis.should eq analysis
|
47
47
|
end
|
48
|
+
|
49
|
+
it 'clones the hash' do
|
50
|
+
subject.analysis.object_id.should_not eq analysis.object_id
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
context 'when analysis is nil' do
|
55
|
+
let(:analysis) { nil }
|
56
|
+
|
57
|
+
it 'sets the analysis to the analysis boilerplate' do
|
58
|
+
subject.analysis.should eq subject.boilerplate
|
59
|
+
end
|
60
|
+
|
61
|
+
it 'clones the hash' do
|
62
|
+
subject.analysis.object_id.should_not eq subject.boilerplate.object_id
|
63
|
+
end
|
48
64
|
end
|
49
65
|
end
|
50
66
|
|
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.3.
|
4
|
+
version: 0.3.1
|
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-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|