Class: Mutest::SourceFile Private

Inherits:
Object
  • Object
show all
Includes:
Adamantium
Defined in:
lib/mutest/source_file.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

A source file representation

Constant Summary collapse

COMMENT_TEXT =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

'# mutest:disable'.freeze

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path, ast, comments) ⇒ SourceFile

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of SourceFile.



15
16
17
18
19
# File 'lib/mutest/source_file.rb', line 15

def initialize(path, ast, comments)
  super(path, ast)

  @comments = comments
end

Class Method Details

.read(path) ⇒ undefined

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Read and parse file with comments

Returns:

  • (undefined)


11
12
13
# File 'lib/mutest/source_file.rb', line 11

def self.read(path)
  new(path, *::Parser::CurrentRuby.parse_with_comments(path.read))
end

Instance Method Details

#ignore?(node) ⇒ Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

TODO: Support multiple lines of comments preceeding a disable TODO: Support inline comment disable

Returns:

  • (Boolean)


23
24
25
26
27
28
# File 'lib/mutest/source_file.rb', line 23

def ignore?(node)
  location = node.location
  return false unless location && location.expression

  disable_lines.include?(location.line)
end