class RuboCop::AST::DefNode

to all ‘def` nodes within RuboCop.
node when the builder constructs the AST, making its methods available
A node extension for `def` nodes. This will be used in place of a plain

def argument_forwarding?

Returns:
  • (Boolean) - whether the `def` node uses argument forwarding

Other tags:
    Note: - This is written in a way that may support lead arguments
def argument_forwarding?
  arguments.any?(&:forward_args_type?)
end

def arguments

Returns:
  • (Array) - the arguments of the method definition
def arguments
  node_parts[1]
end

def body

Returns:
  • (Node) - the body of the method definition

Other tags:
    Note: - this can be either a `begin` node, if the method body contains
def body
  node_parts[0]
end

def method_name

Returns:
  • (Symbol) - the name of the defined method
def method_name
  node_parts[2]
end

def node_parts

Returns:
  • (Array) - the different parts of the `def` or `defs` node
def node_parts
  to_a.reverse
end

def receiver

Returns:
  • (Node, nil) - the receiver of the method definition, or `nil`.
def receiver
  node_parts[3]
end

def void_context?

Returns:
  • (Boolean) - whether the `def` node body is a void context
def void_context?
  method?(:initialize) || assignment_method?
end