Module: RuboCop::RSpec::Node

Defined in:
lib/rubocop/rspec/node.rb

Overview

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

Instance Method Summary collapse

Instance Method Details

#recursive_literal_or_const?Boolean

In various cops we want to regard const as literal although it’s not strictly literal.

Returns:

  • (Boolean)


9
10
11
12
13
14
15
16
# 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