Module: RuboCop::AST::ParameterizedNode::RestArguments
- Includes:
- RuboCop::AST::ParameterizedNode
- Included in:
- IndexNode, IndexasgnNode, LambdaNode, SendNode
- Defined in:
- lib/rubocop/ast/node/mixin/parameterized_node.rb
Overview
A specialized ‘ParameterizedNode`. Requires implementing `first_argument_index` Implements `arguments` as `children` and optimizes other calls
Instance Method Summary collapse
-
#arguments ⇒ Array<Node>
Arguments, if any.
-
#arguments? ⇒ Boolean
Checks whether this node has any arguments.
-
#first_argument ⇒ Node?
A shorthand for getting the first argument of the node.
-
#last_argument ⇒ Node?
A shorthand for getting the last argument of the node.
Methods included from RuboCop::AST::ParameterizedNode
#block_argument?, #parenthesized?, #splat_argument?
Instance Method Details
#arguments ⇒ Array<Node>
Returns arguments, if any.
86 87 88 |
# File 'lib/rubocop/ast/node/mixin/parameterized_node.rb', line 86 def arguments children[first_argument_index..-1].freeze end |
#arguments? ⇒ Boolean
Checks whether this node has any arguments.
111 112 113 |
# File 'lib/rubocop/ast/node/mixin/parameterized_node.rb', line 111 def arguments? children.size > first_argument_index end |
#first_argument ⇒ Node?
A shorthand for getting the first argument of the node. Equivalent to ‘arguments.first`.
95 96 97 |
# File 'lib/rubocop/ast/node/mixin/parameterized_node.rb', line 95 def first_argument children[first_argument_index] end |
#last_argument ⇒ Node?
A shorthand for getting the last argument of the node. Equivalent to ‘arguments.last`.
104 105 106 |
# File 'lib/rubocop/ast/node/mixin/parameterized_node.rb', line 104 def last_argument children[-1] if arguments? end |