yeller_ruby 0.0.8 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/yeller/rails.rb +25 -4
- data/lib/yeller/version.rb +1 -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: 9be335c24f5bc5cc32739b5dd1e213ab257b0ee8
|
4
|
+
data.tar.gz: 6fe8f356c2bd651b6da8a99c68cf8709b38e1f96
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a31b8067de2352ece465297e840212a8975bde91fc3a0c5846b53bc6e5f4be2e09f02cffa8153b00271f7929b8d7177893fd30b39af82f6049910bcb21836679
|
7
|
+
data.tar.gz: 0d26f185687705c49af4dba7536cc44c2bbeffe116a9ef9d3092ac0971a8c9d5f576e95c0af09d4fda51ed65335abf46983ad6b8651e922a587c7fb306e90668
|
data/lib/yeller/rails.rb
CHANGED
@@ -20,6 +20,28 @@ module Yeller
|
|
20
20
|
Yeller::Rack.client
|
21
21
|
end
|
22
22
|
|
23
|
+
module ControllerMethods
|
24
|
+
def _yeller_custom_data
|
25
|
+
out = {
|
26
|
+
:params => params,
|
27
|
+
:session => env.fetch('rack.session', {})
|
28
|
+
}
|
29
|
+
out.merge!(yeller_user_data || {})
|
30
|
+
if respond_to?(:yeller_custom_data)
|
31
|
+
out.merge!(yeller_custom_data || {})
|
32
|
+
end
|
33
|
+
out
|
34
|
+
end
|
35
|
+
|
36
|
+
def yeller_user_data
|
37
|
+
return {} unless respond_to?(:current_user)
|
38
|
+
return {} unless current_user.respond_to?(:id)
|
39
|
+
id = current_user.id
|
40
|
+
return {} unless id.is_a?(Integer)
|
41
|
+
{"user" => {"id" => id}}
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
23
45
|
module ActionControllerCatchingHooks
|
24
46
|
def self.included(base)
|
25
47
|
base.send(:alias_method, :render_exception_without_yeller, :render_exception)
|
@@ -35,10 +57,8 @@ module Yeller
|
|
35
57
|
exception,
|
36
58
|
:url => request.url,
|
37
59
|
:location => "#{controller.class.to_s}##{params[:action]}",
|
38
|
-
:custom_data =>
|
39
|
-
|
40
|
-
:session => env.fetch('rack.session', {})
|
41
|
-
})
|
60
|
+
:custom_data => controller._yeller_custom_data
|
61
|
+
)
|
42
62
|
|
43
63
|
render_exception_without_yeller(env, exception)
|
44
64
|
end
|
@@ -55,6 +75,7 @@ module Yeller
|
|
55
75
|
elsif defined(::ActionDispatch::ShowExceptions)
|
56
76
|
::ActionDispatch::ShowExceptions.send(:include, Yeller::Rails::ActionControllerCatchingHooks)
|
57
77
|
end
|
78
|
+
ActionController::Base.send(:include, Yeller::Rails::ControllerMethods)
|
58
79
|
end
|
59
80
|
end
|
60
81
|
end
|
data/lib/yeller/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: yeller_ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tom Crayford
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-09-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|