hoover 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +4 -0
- data/README.md +4 -3
- data/lib/hoover/job.rb +22 -1
- data/lib/hoover/version.rb +1 -1
- data/spec/job_spec.rb +11 -0
- metadata +12 -12
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -54,9 +54,10 @@ If you add with the same key more than once, Hoover automatically rolls it up in
|
|
54
54
|
|
55
55
|
## Todo
|
56
56
|
|
57
|
-
*
|
58
|
-
|
59
|
-
*
|
57
|
+
* Provide config option to set the logglier during Rails initialization, thus guaranteeing its presence beyond what is
|
58
|
+
possible with simple ActionController filters.
|
59
|
+
* Write specs for Rails components.
|
60
|
+
* Provide config option to choose which log subscribers to enable.
|
60
61
|
|
61
62
|
|
62
63
|
## Contributing to Hoover
|
data/lib/hoover/job.rb
CHANGED
@@ -9,7 +9,7 @@ module Hoover
|
|
9
9
|
end
|
10
10
|
|
11
11
|
def add(hash)
|
12
|
-
hash.each do |k,v|
|
12
|
+
sanitize(hash).each do |k,v|
|
13
13
|
if @hash.key?(k)
|
14
14
|
@hash[k] << v
|
15
15
|
else
|
@@ -27,5 +27,26 @@ module Hoover
|
|
27
27
|
@hash.each{ |k,v| @hash[k] = @hash[k].first if v.size == 1 }
|
28
28
|
@logglier.info(@hash)
|
29
29
|
end
|
30
|
+
|
31
|
+
private
|
32
|
+
|
33
|
+
def sanitize(value)
|
34
|
+
if value.is_a?(Hash)
|
35
|
+
value.inject({}){ |out,(k,v)| out[k] = sanitize(v); out }
|
36
|
+
elsif value.is_a?(Array)
|
37
|
+
value.map{ |v| sanitize(v) }
|
38
|
+
else
|
39
|
+
sanitize_object(value)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
def sanitize_object(value)
|
44
|
+
case value
|
45
|
+
when String, Fixnum, Date, Time, NilClass
|
46
|
+
value
|
47
|
+
else
|
48
|
+
value.to_s
|
49
|
+
end
|
50
|
+
end
|
30
51
|
end
|
31
52
|
end
|
data/lib/hoover/version.rb
CHANGED
data/spec/job_spec.rb
CHANGED
@@ -68,4 +68,15 @@ describe Hoover::Job do
|
|
68
68
|
@job.post
|
69
69
|
end
|
70
70
|
end
|
71
|
+
|
72
|
+
describe "unexpected object type" do
|
73
|
+
it "converts to string" do
|
74
|
+
@object = Object.new
|
75
|
+
def @object.to_s
|
76
|
+
"My String Representation"
|
77
|
+
end
|
78
|
+
@job.add(:foo => @object)
|
79
|
+
@job.hash.must_equal({:foo => ["My String Representation"]})
|
80
|
+
end
|
81
|
+
end
|
71
82
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hoover
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2011-10-
|
12
|
+
date: 2011-10-24 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: logglier
|
16
|
-
requirement: &
|
16
|
+
requirement: &70110723980740 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: 0.2.6
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70110723980740
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: bundler
|
27
|
-
requirement: &
|
27
|
+
requirement: &70110723980320 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70110723980320
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: rake
|
38
|
-
requirement: &
|
38
|
+
requirement: &70110723979860 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: '0'
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70110723979860
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: minitest
|
49
|
-
requirement: &
|
49
|
+
requirement: &70110723979440 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ! '>='
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: '0'
|
55
55
|
type: :development
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *70110723979440
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: mocha
|
60
|
-
requirement: &
|
60
|
+
requirement: &70110723979020 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ! '>='
|
@@ -65,7 +65,7 @@ dependencies:
|
|
65
65
|
version: '0'
|
66
66
|
type: :development
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *70110723979020
|
69
69
|
description: Sets up a hash at the beginning of each request and flushes it to Loggly
|
70
70
|
at the end of the request. Also comes with standard Rails 3 log subscribers.
|
71
71
|
email:
|