lib/rubocop/cop/rails/redundant_allow_nil.rb in rubocop-rails-2.11.2 vs lib/rubocop/cop/rails/redundant_allow_nil.rb in rubocop-rails-2.11.3

- old
+ new

@@ -54,12 +54,12 @@ private def register_offense(allow_nil, message) add_offense(allow_nil, message: message) do |corrector| - prv_sib = previous_sibling(allow_nil) - nxt_sib = next_sibling(allow_nil) + prv_sib = allow_nil.left_sibling + nxt_sib = allow_nil.right_sibling if nxt_sib corrector.remove(range_between(node_beg(allow_nil), node_beg(nxt_sib))) elsif prv_sib corrector.remove(range_between(node_end(prv_sib), node_end(allow_nil))) @@ -84,17 +84,9 @@ found_in_children_nodes = find_allow_nil_and_allow_blank(child_node) return found_in_children_nodes if found_in_children_nodes end nil - end - - def previous_sibling(node) - node.parent.children[node.sibling_index - 1] - end - - def next_sibling(node) - node.parent.children[node.sibling_index + 1] end def node_beg(node) node.loc.expression.begin_pos end