module RuboCop::RSpec::Node

RuboCop-RSpec specific extensions of RuboCop::AST::Node

Public Instance Methods

recursive_literal_or_const?() click to toggle source

In various cops we want to regard const as literal althought it's not strictly literal.

# File lib/rubocop/rspec/node.rb, line 9
def recursive_literal_or_const?
  case type
  when :begin, :pair, *AST::Node::COMPOSITE_LITERALS
    children.all?(&:recursive_literal_or_const?)
  else
    literal? || const_type?
  end
end