lib/rubocop/cop/layout/class_structure.rb in rubocop-0.67.2 vs lib/rubocop/cop/layout/class_structure.rb in rubocop-0.68.0

- old
+ new

@@ -221,11 +221,12 @@ yield node, classification end end def class_elements(class_node) - *, class_def = class_node.children + class_def = class_node.body + return [] unless class_def if class_def.def_type? || class_def.send_type? [class_def] else @@ -238,12 +239,12 @@ classification.to_s.end_with?('=') || expected_order.index(classification).nil? end def node_visibility(node) - _, method_name, = *find_visibility_start(node) - method_name || :public + scope = find_visibility_start(node) + scope && scope.method_name || :public end def find_visibility_start(node) left_siblings_of(node) .reverse @@ -270,12 +271,11 @@ def left_siblings_of(node) siblings_of(node)[0, node.sibling_index] end def humanize_node(node) - method_name, = *node if node.def_type? - return :initializer if method_name == :initialize + return :initializer if node.method?(:initialize) return "#{node_visibility(node)}_methods" end HUMANIZED_NODE_TYPE[node.type] || node.type end