rails-callback_log 0.2.2 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/lib/rails-callback_log.rb +17 -14
- data/lib/rails_callback_log/version.rb +1 -3
- data/rails-callback_log.gemspec +2 -2
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: dbec58f6b26e03bbc9f75013e301a2215086525f735fffedc050b7089008b443
|
4
|
+
data.tar.gz: 191b4e30f3ecdb953983ee55b07afac4c918f346cf8e723cb1240aaa5771f489
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b2d0426d007902af9d7620143804655473369e5e7e55e9153d7ba0f8bb3dd269599d9a80842bc4af60d8a7804272d7052244ac873595d3297b4c16d7d369625d
|
7
|
+
data.tar.gz: a1ea57f878149dddbba2b5e94876b2c674a303623db399c468c6e6b80e4e0b10c09daaec0404a6110bcfdbc140478a4d9ad94f292e483168813736be089f299a
|
data/lib/rails-callback_log.rb
CHANGED
@@ -17,6 +17,12 @@ module RailsCallbackLog
|
|
17
17
|
source_location_filters.any? { |f| str.start_with?(f) }
|
18
18
|
end
|
19
19
|
|
20
|
+
def log(msg)
|
21
|
+
if !FILTER || caller.any? { |line| matches_filter?(line) }
|
22
|
+
logger.debug(format("Callback: %s", msg))
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
20
26
|
private
|
21
27
|
|
22
28
|
def source_location_filters
|
@@ -26,16 +32,15 @@ module RailsCallbackLog
|
|
26
32
|
|
27
33
|
# In rails 5.1, we extend `CallTemplate`.
|
28
34
|
module CallTemplateExtension
|
29
|
-
#
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
}
|
35
|
+
# Rails 5.1 and above call `expand` to get a reference to the object and
|
36
|
+
# method of the callback to execute. If the callback was a proc then
|
37
|
+
# @override_block will be set. If the callback was an object then
|
38
|
+
# @override_target will be set. If the callback was a symbol method name
|
39
|
+
# then @method_name will be set.
|
40
|
+
def expand(target, value, block)
|
41
|
+
::RailsCallbackLog.log(@override_block || @override_target || @method_name)
|
42
|
+
|
43
|
+
super(target, value, block)
|
39
44
|
end
|
40
45
|
end
|
41
46
|
|
@@ -45,10 +50,8 @@ module RailsCallbackLog
|
|
45
50
|
def make_lambda(filter)
|
46
51
|
original_lambda = super(filter)
|
47
52
|
lambda { |*args, &block|
|
48
|
-
|
49
|
-
|
50
|
-
::RailsCallbackLog.logger.debug(format("Callback: %s", filter))
|
51
|
-
end
|
53
|
+
::RailsCallbackLog.log(filter)
|
54
|
+
|
52
55
|
original_lambda.call(*args, &block)
|
53
56
|
}
|
54
57
|
end
|
data/rails-callback_log.gemspec
CHANGED
@@ -5,7 +5,7 @@ require "rails_callback_log/version"
|
|
5
5
|
|
6
6
|
::Gem::Specification.new do |spec|
|
7
7
|
spec.name = "rails-callback_log"
|
8
|
-
spec.version = ::RailsCallbackLog
|
8
|
+
spec.version = ::RailsCallbackLog.gem_version.to_s
|
9
9
|
spec.authors = ["Jared Beck"]
|
10
10
|
spec.email = ["jared@jaredbeck.com"]
|
11
11
|
spec.summary = "Logs callbacks to help with debugging."
|
@@ -20,7 +20,7 @@ require "rails_callback_log/version"
|
|
20
20
|
]
|
21
21
|
spec.require_paths = ["lib"]
|
22
22
|
spec.required_ruby_version = ">= 2.0"
|
23
|
-
spec.add_runtime_dependency "activesupport", [">= 4.2.0", "<
|
23
|
+
spec.add_runtime_dependency "activesupport", [">= 4.2.0", "< 6"]
|
24
24
|
spec.add_development_dependency "appraisal", "~> 2.2"
|
25
25
|
spec.add_development_dependency "bundler", "~> 1.12"
|
26
26
|
spec.add_development_dependency "rake", "~> 10.0"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails-callback_log
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jared Beck
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-01-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -19,7 +19,7 @@ dependencies:
|
|
19
19
|
version: 4.2.0
|
20
20
|
- - "<"
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version: '
|
22
|
+
version: '6'
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -29,7 +29,7 @@ dependencies:
|
|
29
29
|
version: 4.2.0
|
30
30
|
- - "<"
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version: '
|
32
|
+
version: '6'
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
34
|
name: appraisal
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
@@ -118,7 +118,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
118
118
|
version: '0'
|
119
119
|
requirements: []
|
120
120
|
rubyforge_project:
|
121
|
-
rubygems_version: 2.6
|
121
|
+
rubygems_version: 2.7.6
|
122
122
|
signing_key:
|
123
123
|
specification_version: 4
|
124
124
|
summary: Logs callbacks to help with debugging.
|