tapping_device 0.5.4 → 0.5.5

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: 231efa59a44f630df303db52d0d3bb460698c02a116374838e4bad4d71d7f69e
4
- data.tar.gz: ca80df8a0ea00350c1e074628425848b5cba4d7f53a7aa4176947d55a3164929
3
+ metadata.gz: c63ce4e4858d3782152aa6a3bf320ac2a4f04f8ed733529b359a3bb8d331b53b
4
+ data.tar.gz: 3e0c20025265029c50a92ae563f9474667c964e9f45f08aae9712343b07f9a00
5
5
  SHA512:
6
- metadata.gz: 77131aab9e85a2661694ee57470b9067ee44d479d574cbe395eefabd7f88350eaf31071c4ed0d117b1608856e9e6beff9d7ccae592a665c8969231425dafdc43
7
- data.tar.gz: c06dedd14da7798cf93d80ae0d4866928c9e2522184f453588691fdf1a3220b21cfdf953f04575f1015cc1cb58c5bcb2cb5673fd9384cf5515855d048d0bbdb3
6
+ metadata.gz: 97ad06b1e7036ba88fa172db1e6908da7c85f28caf5592994829b40bcb3e999344c4cafb5f28e51cb87809a9a48f196dd34007d698e6ec363835ef6a095a7613
7
+ data.tar.gz: bd100d874f054ae5836d047d6f1acf142123b322c9b7bec7f6ef5f273823944e12ba11e9e9041f8bbd349575ac25b374ab8508393eb3468fd6c747b7b0dd9fd0
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- tapping_device (0.5.4)
4
+ tapping_device (0.5.5)
5
5
  activerecord (>= 5.2)
6
6
  activesupport
7
7
  pry
@@ -56,7 +56,7 @@ GEM
56
56
  thread_safe (0.3.6)
57
57
  tzinfo (1.2.7)
58
58
  thread_safe (~> 0.1)
59
- zeitwerk (2.3.1)
59
+ zeitwerk (2.4.0)
60
60
 
61
61
  PLATFORMS
62
62
  ruby
@@ -158,10 +158,7 @@ class TappingDevice
158
158
  end
159
159
 
160
160
  def get_method_object_from(target, method_name)
161
- target.method(method_name)
162
- rescue ArgumentError
163
- method_method = Object.method(:method).unbind
164
- method_method.bind(target).call(method_name)
161
+ Object.instance_method(:method).bind(target).call(method_name)
165
162
  rescue NameError
166
163
  # if any part of the program uses Refinement to extend its methods
167
164
  # we might still get NoMethodError when trying to get that method outside the scope
@@ -36,7 +36,7 @@ class TappingDevice
36
36
  define_method "#{output_action}_instance_#{subject}" do |target_klass, options = {}|
37
37
  collection_proxy = AsyncCollectionProxy.new
38
38
 
39
- tap_init!(target_klass, options) do |payload|
39
+ tap_init!(target_klass, options.merge(force_recording: true)) do |payload|
40
40
  collection_proxy << send(helper_method_name, payload.return_value, options)
41
41
  end
42
42
 
@@ -9,6 +9,12 @@ class TappingDevice
9
9
  @options[:event_type] = [event_type, "c_#{event_type}"]
10
10
  end
11
11
 
12
+ def track(object)
13
+ super
14
+ @options[:is_active_record_model] = target.ancestors.include?(ActiveRecord::Base)
15
+ self
16
+ end
17
+
12
18
  def build_payload(tp:, filepath:, line_number:)
13
19
  payload = super
14
20
  payload[:return_value] = payload[:receiver]
@@ -24,8 +30,8 @@ class TappingDevice
24
30
  receiver = tp.self
25
31
  method_name = tp.callee_id
26
32
 
27
- if target.ancestors.include?(ActiveRecord::Base)
28
- method_name == :new && receiver.ancestors.include?(target)
33
+ if @options[:is_active_record_model]
34
+ method_name == :new && receiver.is_a?(Class) && receiver.ancestors.include?(target)
29
35
  else
30
36
  method_name == :initialize && receiver.is_a?(target)
31
37
  end
@@ -1,3 +1,3 @@
1
1
  class TappingDevice
2
- VERSION = "0.5.4"
2
+ VERSION = "0.5.5"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tapping_device
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.4
4
+ version: 0.5.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - st0012
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-07-05 00:00:00.000000000 Z
11
+ date: 2020-07-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord