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?) || arguments.any?(&:forward_arg_type?)
end

def arguments

Returns:
  • (Array) - the arguments of the method definition
def arguments
  children[-2]
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
  children[-1]
end

def endless?

Returns:
  • (Boolean) - if the definition is without an `end` or not.
def endless?
  !loc.end
end

def method_name

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

def receiver

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

def void_context?

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