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 percent_literal?(type = nil)

Returns:
  • (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 && loc.begin.source.start_with?('%')
  end
end

def square_brackets?

Returns:
  • (Boolean) - whether the array is enclosed in square brackets
def square_brackets?
  loc.begin && loc.begin.is?('[')
end

def values

Returns:
  • (Array) - an array of value nodes
def values
  each_child_node.to_a
end