dark_finger 0.1.2 → 0.1.3

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: 691ef579dbf429a052c26b395f134eac60b966b88530532d081ba2a7c1be539e
4
- data.tar.gz: b7c3a20843d94b65acf5724f2673d6d4fbb65308a34a92b770aa90f13ce6be4d
3
+ metadata.gz: c04e8ab4c8e6ae562966f4a5609d9d3df06b486fbf52ec977be9f54635577b4c
4
+ data.tar.gz: 5d54afcdb9d594e2574302612a433b278673acae3692911807f22c6d80a12675
5
5
  SHA512:
6
- metadata.gz: fbf4ff76ee9deb51e4266367a8abd2dda6308be95673f22e84d03509dbac76212fc4fd489823e65f065ad05070bdfa524fa8359c317af8143c48f3a667768ec9
7
- data.tar.gz: 5103957b6498e03a508fc8722363eb6f297090534c2206f6134b62218bcb82a2380c0736847d76530fc9ba586fa5d6c33e9c47e68018a5f98cb2b90c785529c6
6
+ metadata.gz: 3c944d2bd65bdd049730b86c44a16f551e3c5de9d79d71f442b92459007a8b3ec3bd2c3220436dba9f065e607041bb3ea9435f010c2ca0e0295aa695b5e25e6f
7
+ data.tar.gz: 7fec157a7910e6a18dc9f12495ff38faec581a190097e3e4300fab723c58acd4ad81201985e0f4f19eac422b8749773b546768b1bcd0df888cdfb57fd01453f0
@@ -1,3 +1,3 @@
1
1
  module DarkFinger
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
3
3
  end
@@ -4,6 +4,7 @@ module RuboCop
4
4
  class ActiveModelNodeDecorator < SimpleDelegator
5
5
  def initialize(node)
6
6
  super
7
+ raise "Cannot decorate nil node" if node.nil?
7
8
  end
8
9
 
9
10
  def node_type
@@ -56,8 +57,19 @@ module RuboCop
56
57
  private
57
58
 
58
59
  def nested_in_with_options?
59
- return true if parent&.method_name == :with_options
60
- return true if parent&.begin_type? && parent&.parent&.method_name == :with_options
60
+ parent_is_with_options? || grandparent_is_with_options?
61
+ end
62
+
63
+ def parent_is_with_options?
64
+ parent.respond_to?(:method_name) && parent&.method_name == :with_options
65
+ end
66
+
67
+ def grandparent_is_with_options?
68
+ grandparent = parent&.parent
69
+ return false unless grandparent
70
+ return false unless grandparent.respond_to?(:method_name)
71
+
72
+ parent.begin_type? && grandparent.method_name == :with_options
61
73
  end
62
74
 
63
75
  def nested_directly_in_class?
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dark_finger
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Professor Wang Matrix PhD