whoops 0.1.9 → 0.1.10
Sign up to get free protection for your applications and to get access to all the features.
- data/app/controllers/events_controller.rb +0 -2
- data/app/models/whoops/event.rb +34 -2
- metadata +4 -4
data/app/models/whoops/event.rb
CHANGED
@@ -11,7 +11,7 @@ class Whoops::Event
|
|
11
11
|
|
12
12
|
validates_presence_of :message
|
13
13
|
|
14
|
-
before_save :set_keywords
|
14
|
+
before_save :set_keywords, :sanitize_details
|
15
15
|
|
16
16
|
def self.record(params)
|
17
17
|
params = params.with_indifferent_access
|
@@ -37,6 +37,39 @@ class Whoops::Event
|
|
37
37
|
add_details_to_keywords(keywords_array)
|
38
38
|
self.keywords = keywords_array.join(" ")
|
39
39
|
end
|
40
|
+
|
41
|
+
def sanitize_details
|
42
|
+
if details.is_a? Hash
|
43
|
+
sanitized_details = {}
|
44
|
+
details.each do |key, value|
|
45
|
+
if key =~ /\./
|
46
|
+
key = key.gsub(/\./, "_")
|
47
|
+
end
|
48
|
+
|
49
|
+
if value.is_a? Hash
|
50
|
+
child_keys = all_keys([value])
|
51
|
+
if child_keys.any?{ |child_key| child_key =~ /\./ }
|
52
|
+
value = value.to_s
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
sanitized_details[key] = value
|
57
|
+
end
|
58
|
+
|
59
|
+
self.details = sanitized_details
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
def all_keys(values)
|
64
|
+
keys = []
|
65
|
+
values.each do |value|
|
66
|
+
if value.is_a? Hash
|
67
|
+
keys |= value.keys
|
68
|
+
keys |= all_keys(value.values)
|
69
|
+
end
|
70
|
+
end
|
71
|
+
keys
|
72
|
+
end
|
40
73
|
|
41
74
|
private
|
42
75
|
|
@@ -53,6 +86,5 @@ class Whoops::Event
|
|
53
86
|
i.to_a.flatten - i.keys
|
54
87
|
end.flatten!
|
55
88
|
end
|
56
|
-
|
57
89
|
end
|
58
90
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: whoops
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 15
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 10
|
10
|
+
version: 0.1.10
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Daniel Higginbotham
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-09-
|
18
|
+
date: 2011-09-29 00:00:00 -05:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|