Class: RuboCop::AST::SuperNode

Inherits:
Node
  • Object
show all
Includes:
ParameterizedNode
Defined in:
lib/rubocop/ast/node/super_node.rb

Overview

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

Constant Summary

Constants inherited from Node

Node::BASIC_LITERALS, Node::COMPARISON_OPERATORS, Node::COMPOSITE_LITERALS, Node::FALSEY_LITERALS, Node::IMMUTABLE_LITERALS, Node::KEYWORDS, Node::LITERALS, Node::MUTABLE_LITERALS, Node::OPERATOR_KEYWORDS, Node::REFERENCES, Node::SPECIAL_KEYWORDS, Node::TRUTHY_LITERALS, Node::VARIABLES

Instance Method Summary collapse

Methods included from ParameterizedNode

#arguments?, #block_argument?, #block_literal?, #block_node, #first_argument, #last_argument, #parenthesized?, #splat_argument?

Methods inherited from Node

#ancestors, #argument?, #asgn_method_call?, #basic_literal?, #binary_operation?, #chained?, #child_nodes, #complete!, #complete?, #const_name, def_matcher, #defined_module, #defined_module_name, #descendants, #each_ancestor, #each_child_node, #each_descendant, #each_node, #falsey_literal?, #immutable_literal?, #initialize, #keyword?, #keyword_bang?, #keyword_not?, #literal?, #multiline?, #mutable_literal?, #numeric_type?, #operator_keyword?, #parent, #parent_module_name, #pure?, #receiver, #reference?, #sibling_index, #single_line?, #source, #source_range, #special_keyword?, #truthy_literal?, #unary_operation?, #updated, #value_used?, #variable?

Methods included from Sexp

#s

Constructor Details

This class inherits a constructor from RuboCop::AST::Node

Instance Method Details

#argumentsArray<Node>

An array containing the arguments of the super invocation.

Returns:

  • (Array<Node>)

    the arguments of the super invocation



21
22
23
# File 'lib/rubocop/ast/node/super_node.rb', line 21

def arguments
  node_parts
end

#method?(name) ⇒ Boolean

Checks whether the method name matches the argument.

Parameters:

  • name (Symbol, String)

    the method name to check for

Returns:

  • (Boolean)

    whether the method name matches the argument



29
30
31
# File 'lib/rubocop/ast/node/super_node.rb', line 29

def method?(name)
  method_name == name.to_sym
end

#method_nameSymbol

The method name of this ‘super` node. Always `:super`.

Returns:

  • (Symbol)

    the method name of ‘super`



14
15
16
# File 'lib/rubocop/ast/node/super_node.rb', line 14

def method_name
  :super
end

#node_partsArray

Custom destructuring method. This can be used to normalize destructuring for different variations of the node.

Returns:

  • (Array)

    the different parts of the ‘block` node



37
38
39
# File 'lib/rubocop/ast/node/super_node.rb', line 37

def node_parts
  to_a
end