Sha256: 56c7c61ccf3f299cf413442aad63d67da834b465339b06d2ff2003ad6bd3a042

Contents?: true

Size: 522 Bytes

Versions: 8

Compression:

Stored size: 522 Bytes

Contents

# frozen_string_literal: true

module RuboCop
  module AST
    # A node extension for `str`, `dstr`, and `xstr` nodes. This will be used
    # in place of a plain node when the builder constructs the AST, making
    # its methods available to all `str` nodes within RuboCop.
    class StrNode < Node
      include BasicLiteralNode

      def character_literal?
        loc.respond_to?(:begin) && loc.begin&.is?('?')
      end

      def heredoc?
        loc.is_a?(Parser::Source::Map::Heredoc)
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
rubocop-ast-1.36.2 lib/rubocop/ast/node/str_node.rb
rubocop-ast-1.36.1 lib/rubocop/ast/node/str_node.rb
rubocop-ast-1.36.0 lib/rubocop/ast/node/str_node.rb
rubocop-ast-1.35.0 lib/rubocop/ast/node/str_node.rb
rubocop-ast-1.34.1 lib/rubocop/ast/node/str_node.rb
rubocop-ast-1.34.0 lib/rubocop/ast/node/str_node.rb
rubocop-ast-1.33.1 lib/rubocop/ast/node/str_node.rb
rubocop-ast-1.33.0 lib/rubocop/ast/node/str_node.rb