class RuboCop::AST::InPatternNode
A node extension for `in` nodes. This will be used in place of a plain node when the builder constructs the AST
, making its methods available to all `in` nodes within RuboCop
.
Public Instance Methods
body()
click to toggle source
Returns the body of the `in` node.
@return [Node, nil] the body of the `in` node
# File lib/rubocop/ast/node/in_pattern_node.rb, line 33 def body node_parts[-1] end
branch_index()
click to toggle source
Returns the index of the `in` branch within the `case` statement.
@return [Integer] the index of the `in` branch
# File lib/rubocop/ast/node/in_pattern_node.rb, line 19 def branch_index parent.in_pattern_branches.index(self) end
pattern()
click to toggle source
Returns a node of the pattern in the `in` branch.
@return [Node] a pattern node
# File lib/rubocop/ast/node/in_pattern_node.rb, line 12 def pattern node_parts.first end
then?()
click to toggle source
Checks whether the `in` node has a `then` keyword.
@return [Boolean] whether the `in` node has a `then` keyword
# File lib/rubocop/ast/node/in_pattern_node.rb, line 26 def then? loc.begin&.is?('then') end