module RuboCop::AST::ParameterizedNode::RestArguments
A specialized `ParameterizedNode`. Requires implementing `first_argument_index` Implements `arguments` as `children` and optimizes other calls
Public Instance Methods
arguments()
click to toggle source
@return [Array<Node>] arguments, if any
# File lib/rubocop/ast/node/mixin/parameterized_node.rb, line 86 def arguments children[first_argument_index..-1].freeze end
arguments?()
click to toggle source
Checks whether this node has any arguments.
@return [Boolean] whether this node has any arguments
# File lib/rubocop/ast/node/mixin/parameterized_node.rb, line 111 def arguments? children.size > first_argument_index end
first_argument()
click to toggle source
A shorthand for getting the first argument of the node. Equivalent to `arguments.first`.
@return [Node, nil] the first argument of the node,
or `nil` if there are no arguments
# File lib/rubocop/ast/node/mixin/parameterized_node.rb, line 95 def first_argument children[first_argument_index] end
last_argument()
click to toggle source
A shorthand for getting the last argument of the node. Equivalent to `arguments.last`.
@return [Node, nil] the last argument of the node,
or `nil` if there are no arguments
# File lib/rubocop/ast/node/mixin/parameterized_node.rb, line 104 def last_argument children[-1] if arguments? end