class RuboCop::AST::ArrayNode
to all ‘array` nodes within RuboCop.
node when the builder constructs the AST, making its methods available
A node extension for `array` nodes. This will be used in place of a plain
def bracketed?
-
(Boolean)
- whether the array is enclosed in percent or square
def bracketed? square_brackets? || percent_literal? end
def each_value(&block)
- Use `values.each` (a.k.a. `children.each`)
def each_value(&block) return to_enum(__method__) unless block values.each(&block) self end
def percent_literal?(type = nil)
-
(Boolean)
- whether the array is enclosed in percent brackets
Parameters:
-
type
(Symbol
) -- an optional percent literal type
Overloads:
-
percent_literal?(type)
-
percent_literal?
def percent_literal?(type = nil) if type loc.begin && loc.begin.source =~ PERCENT_LITERAL_TYPES[type] else loc.begin&.source&.start_with?('%') end end
def square_brackets?
-
(Boolean)
- whether the array is enclosed in square brackets
def square_brackets? loc.begin&.is?('[') end