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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 833bc9f0ef13dc38365b9fed4b4ec1e6d31e3836ae07a44f366e2eb4d198e2d1
4
- data.tar.gz: ae5c7acf603370367d3f77bd7999cfdc51ddce60a886951c4f3b05ca2c4ad442
3
+ metadata.gz: e1d5ce6f77e55850f0208941baa76ad2e6b842fc191a45816a7acc08fdd9295b
4
+ data.tar.gz: '09d69bcc6c5865871fc0ce8a560f3f41a3fb951bbd2bd08051b4ba45526b7d97'
5
5
  SHA512:
6
- metadata.gz: 9a8db105412a32d90e32e5f76947b8740dbc0dbdeebca1981304e1d09bd6922778a02f72e6d62c341df003eef120230bd7d0530b1eb8c797ee4c26d78d8fcc43
7
- data.tar.gz: a1a9685cb4d7e8c3fad3560dd645c0ac7044ec3c1824f9a7abe75d4b0b123d905ea4713344231fef1a0ce78cbb5ac121fac22bbf6e92a939868a89e750102a73
6
+ metadata.gz: a45589c3b67d0108093a9f8e221173d64147cc2b2f06a6fa67ece389d08767e7062b0b6789a68116005944d921aef969685e0b4fe1bc074eb3dc0abb8781ef36
7
+ data.tar.gz: 0aee1ec34d63aad007062478cf5c2f97df97ddbd6975a63744c6acac4aa16602d97feb5327de1131c6f5fff3d00edee1bfc707568606b115e81f0c2787619fc5
@@ -1,3 +1,7 @@
1
+ ## 0.2.1
2
+
3
+ * Fix not to raise error when controllers does not have action definitions.
4
+
1
5
  ## 0.2.0
2
6
 
3
7
  * Stop using TracePoint and just override ActiveSupport::Callbacks::CallTemplate
@@ -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: controller.method(controller.action_name))
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 [APPLIED[:action], @action.name, *@action.source_location]
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
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ActionTracer
4
- VERSION = "0.2.0"
4
+ VERSION = "0.2.1"
5
5
  end
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.0
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-05 00:00:00.000000000 Z
11
+ date: 2020-10-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport