dead_code_detector 0.0.9 → 0.0.10

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: 3cbda8c4192c6fdb3de42f27b5a71fa4a6b76d4508da317a1407c85ac52356ae
4
- data.tar.gz: 23aa9deecb70ed1e0668f07900eab70b8fb88c0e43cd6b2c2bb6783f599c896f
3
+ metadata.gz: 60644539c351c9c6fba75e96f9a0e0b1509d9d2fb5b392613f5ee396d01fc170
4
+ data.tar.gz: b56f91fc57521d3405db882b51b2051972132e8af36663e7eb468a75e0633c00
5
5
  SHA512:
6
- metadata.gz: 3102bcebe94b492da8982a93dcddda32ee7637e767569050944ffe29202035eb6ad3dfa4e20d37b8532a73159084551967a5163840347e1c6f7aac6f7881e284
7
- data.tar.gz: 77404aa0709a6a937116df52f1bfdee1fe44d74d78a6429e6ee2236a768ed53ec9ac497a441c592a21fbe0996476f39e50a1891035795bddc76feeb811722a88
6
+ metadata.gz: b18b4fe4c42e4fd445faf30afd2a74110d819b3518f23f7d7ad3803ca6f72bd58edaf4d02abef4991d1f2a171b0a808e15a3edb4a7cd4ac3521e70e9ef8bc343
7
+ data.tar.gz: 8ddce2288950a82afe6674151918e2c130eb331c37f0b6e32485343b85686a36b1381f44e098f8e2611f7b008b8e925bc2c5dce3f16b64a6100777db77cb3fe0
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- dead_code_detector (0.0.9)
4
+ dead_code_detector (0.0.10)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -23,6 +23,10 @@ module DeadCodeDetector
23
23
  end
24
24
  end
25
25
 
26
+ def number_of_tracked_methods
27
+ default_methods.count
28
+ end
29
+
26
30
  def clear_cache
27
31
  DeadCodeDetector.config.storage.clear(self.class.record_key(klass.name))
28
32
  end
@@ -44,7 +44,7 @@ module DeadCodeDetector
44
44
  end
45
45
 
46
46
  def default_methods
47
- klass.methods.map(&:to_s).select do |method_name|
47
+ @default_methods ||= klass.methods.map(&:to_s).select do |method_name|
48
48
  owned_method?(method_name) && target_directory?(method_name)
49
49
  end
50
50
  end
@@ -61,9 +61,11 @@ module DeadCodeDetector
61
61
  end
62
62
 
63
63
  def cache_methods_for(klass)
64
- DeadCodeDetector.config.storage.add(tracked_classes_key, klass.name)
65
- DeadCodeDetector::ClassMethodWrapper.new(klass).refresh_cache
66
- DeadCodeDetector::InstanceMethodWrapper.new(klass).refresh_cache
64
+ class_wrapper = DeadCodeDetector::ClassMethodWrapper.new(klass).tap(&:refresh_cache)
65
+ instance_wrapper = DeadCodeDetector::InstanceMethodWrapper.new(klass).tap(&:refresh_cache)
66
+ if class_wrapper.number_of_tracked_methods + instance_wrapper.number_of_tracked_methods > 0
67
+ DeadCodeDetector.config.storage.add(tracked_classes_key, klass.name)
68
+ end
67
69
  end
68
70
 
69
71
  def tracked_classes_key
@@ -38,7 +38,7 @@ module DeadCodeDetector
38
38
  end
39
39
 
40
40
  def default_methods
41
- klass.instance_methods.map(&:to_s).select do |method_name|
41
+ @default_methods ||= klass.instance_methods.map(&:to_s).select do |method_name|
42
42
  owned_method?(method_name) && target_directory?(method_name)
43
43
  end
44
44
  end
@@ -1,3 +1,3 @@
1
1
  module DeadCodeDetector
2
- VERSION = "0.0.9"
2
+ VERSION = "0.0.10"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dead_code_detector
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.9
4
+ version: 0.0.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kyle d'Oliveira
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-05-13 00:00:00.000000000 Z
11
+ date: 2019-05-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler