Sha256: d2a6e52992a5aeefd84468a1c387059ee38d5c8f366b1c273fa5b46ff1a475f0

Contents?: true

Size: 499 Bytes

Versions: 41

Compression:

Stored size: 499 Bytes

Contents

# frozen_string_literal: true

module RuboCop
  module RSpec
    # RuboCop RSpec specific extensions of RuboCop::AST::Node
    module Node
      # In various cops we want to regard const as literal although it's not
      # strictly literal.
      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
    end
  end
end

Version data entries

41 entries across 37 versions & 4 rubygems

Version Path
rubocop-rspec-2.12.0 lib/rubocop/rspec/node.rb