Files

Class/Module Index [+]

Quicksearch

RuboCop::Cop::VariableForce::Locatable

This module provides a way to locate the conditional branch the node is in. This is intended to be used as mix-in.

Public Instance Methods

ancestor_nodes_in_scope() click to toggle source
# 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
branch_body_node() click to toggle source

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
branch_id() click to toggle source
# 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
branch_point_node() click to toggle source

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
branch_type() click to toggle source
# 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
inside_of_branch?() click to toggle source
# File lib/rubocop/cop/variable_force/locatable.rb, line 25
def inside_of_branch?
  branch_point_node
end
node() click to toggle source
# File lib/rubocop/cop/variable_force/locatable.rb, line 17
def node
  fail '#node must be declared!'
end
scope() click to toggle source
# File lib/rubocop/cop/variable_force/locatable.rb, line 21
def scope
  fail '#scope must be declared!'
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.