This module provides a way to locate the conditional branch the node is in. This is intended to be used as mix-in.
# File lib/rubocop/cop/variable_force/locatable.rb, line 59 def ancestor_nodes_in_scope @ancestor_nodes_in_scope ||= scope.ancestors_of_node(@node) end
A child node of branch_point_node this assignment belongs.
# File lib/rubocop/cop/variable_force/locatable.rb, line 50 def branch_body_node if instance_variable_defined?(:@branch_body_node) return @branch_body_node end set_branch_point_and_body_nodes! @branch_body_node end
# File lib/rubocop/cop/variable_force/locatable.rb, line 29 def branch_id return nil unless inside_of_branch? @branch_id ||= [branch_point_node.object_id, branch_type].join('_') end
Inner if, case, rescue, or ensure node.
# File lib/rubocop/cop/variable_force/locatable.rb, line 40 def branch_point_node if instance_variable_defined?(:@branch_point_node) return @branch_point_node end set_branch_point_and_body_nodes! @branch_point_node end
# File lib/rubocop/cop/variable_force/locatable.rb, line 34 def branch_type return nil unless inside_of_branch? @branch_type ||= [branch_point_node.type, branch_body_name].join('_') end
# File lib/rubocop/cop/variable_force/locatable.rb, line 25 def inside_of_branch? branch_point_node end
Generated with the Darkfish Rdoc Generator 2.