do_not_use 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6896cabb0a8a7e577ab250ce73f0de5c141c3e5132ca2b3f3c8f90b0f5db2ea1
4
- data.tar.gz: 54faf975c3653b9ff23821f42128b5433935f7ade489f5654f68d2741d628a09
3
+ metadata.gz: b93787f765735c96304881e364255c8c0fe8a664b43bc737a2b43a4ad0e6cbda
4
+ data.tar.gz: 3004281bae0b9d14dcd6a255990db6ba301d0798b8f42c09b94efffa1709eebf
5
5
  SHA512:
6
- metadata.gz: dac8bb46aa616d09192d07e2c26cb573e8278cd45ce3f22e94cb4de8fef301986db16c44de6ddc4789edea378bdb5f48ef2fbe7dd9e354569a6bf64e0785ab49
7
- data.tar.gz: c8c79e221519af21ff806786da4ecd432eaedb75dda4920cac68692430ed559df37ed0c4f87a89e4b7f3f43c1f65cfc06c6367b4034d5575d2820123d45c171f
6
+ metadata.gz: 690b17642309d4bb33d17b24641df0ab00321db20c6b223765d51ced50a8007e61a12992f51666f0a36f61f3f3f99fface0b2bd8d7735cdb2243bd3ab827b163
7
+ data.tar.gz: 6bcd554bc83be5bc8ab01e4e4f95add790b16a0a5609b5377f8b972135fd62a3aef1b5a822541ae7bf6ea893519a63f8aceff77ab0572d9ff8aa91fa9a265ff6
data/README.md CHANGED
@@ -112,7 +112,7 @@ DoNotUse.configure do |config|
112
112
  config.ignored_paths << Rails.root.join("spec") # The paths which you don't want to track.
113
113
  config.exceptions_yaml_path = Rails.root.join("exceptions.yaml") # The YAML file path where you specify existing usages of the deprecated APIs.
114
114
  config.signature_generators = {
115
- Rails.root.join("spec", "models") => Proc.new { |instruction| ... }
115
+ Proc.new { |location| location.starts_with?(Rails.root.join("spec", "models").to_s) } => Proc.new { |instruction| ... }
116
116
  } # Helps you configure how the instruction signatures are generated for the ignored paths.
117
117
  end
118
118
  ```
@@ -34,6 +34,10 @@ module DoNotUse
34
34
  !location.track? && inherited_method?
35
35
  end
36
36
 
37
+ def location
38
+ @location ||= Location.new(source_path)
39
+ end
40
+
37
41
  delegate :frame_type, to: :binding
38
42
  delegate :signature_generator, to: :location
39
43
 
@@ -52,10 +56,6 @@ module DoNotUse
52
56
  Location.new(receiver_source_path.first)
53
57
  end
54
58
 
55
- def location
56
- @location ||= Location.new(source_path)
57
- end
58
-
59
59
  def inherited_method?
60
60
  receiver != method_owner
61
61
  end
@@ -15,9 +15,11 @@ module DoNotUse
15
15
  #
16
16
  # This allows users to define signatures for those instructions as they see fit.
17
17
  def signature_generator
18
- signature_generators.find { |path, _| source_path.starts_with?(path) }&.second
18
+ signature_generators.find { |proc, _| proc.call(self) }&.second
19
19
  end
20
20
 
21
+ delegate :starts_with?, to: :source_path
22
+
21
23
  private
22
24
 
23
25
  attr_reader :source_path
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module DoNotUse
4
- VERSION = "0.1.0"
4
+ VERSION = "0.2.0"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: do_not_use
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mehmet Emin INAC