action_tracer 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/action_tracer/filters.rb +23 -2
- data/lib/action_tracer/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e1d5ce6f77e55850f0208941baa76ad2e6b842fc191a45816a7acc08fdd9295b
|
4
|
+
data.tar.gz: '09d69bcc6c5865871fc0ce8a560f3f41a3fb951bbd2bd08051b4ba45526b7d97'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a45589c3b67d0108093a9f8e221173d64147cc2b2f06a6fa67ece389d08767e7062b0b6789a68116005944d921aef969685e0b4fe1bc074eb3dc0abb8781ef36
|
7
|
+
data.tar.gz: 0aee1ec34d63aad007062478cf5c2f97df97ddbd6975a63744c6acac4aa16602d97feb5327de1131c6f5fff3d00edee1bfc707568606b115e81f0c2787619fc5
|
data/CHANGELOG.md
CHANGED
@@ -22,6 +22,27 @@ module ActionTracer
|
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
25
|
+
class Action
|
26
|
+
def initialize(name:, method:)
|
27
|
+
@name = name
|
28
|
+
@method = method
|
29
|
+
end
|
30
|
+
|
31
|
+
def self.build(controller)
|
32
|
+
method = controller.respond_to?(controller.action_name) ? controller.method(controller.action_name) : nil_method
|
33
|
+
new(name: controller.action_name, method: method)
|
34
|
+
end
|
35
|
+
|
36
|
+
def to_a
|
37
|
+
[APPLIED[:action], @name, *@method.source_location]
|
38
|
+
end
|
39
|
+
|
40
|
+
def self.nil_method
|
41
|
+
method(:p)
|
42
|
+
end
|
43
|
+
private_class_method :nil_method
|
44
|
+
end
|
45
|
+
|
25
46
|
class Filters
|
26
47
|
def initialize(before = [], after = [], around = [], action:)
|
27
48
|
@before = before
|
@@ -38,12 +59,12 @@ module ActionTracer
|
|
38
59
|
Filter.new(f, method: f.is_a?(Symbol) ? controller.method(f) : f)
|
39
60
|
end
|
40
61
|
end
|
41
|
-
new(filters[:before], filters[:after], filters[:around], action:
|
62
|
+
new(filters[:before], filters[:after], filters[:around], action: Action.build(controller))
|
42
63
|
end
|
43
64
|
|
44
65
|
def print
|
45
66
|
invoked_before.map(&:to_a).each { |filter| ActionTracer.logger.info filter }
|
46
|
-
ActionTracer.logger.info
|
67
|
+
ActionTracer.logger.info @action.to_a
|
47
68
|
invoked_after.map(&:to_a).reverse_each { |filter| ActionTracer.logger.info filter }
|
48
69
|
end
|
49
70
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: action_tracer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- makicamel
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-10-
|
11
|
+
date: 2020-10-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|