Class: SimpleCov::SourceFile::MethodBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/simplecov/source_file/method_builder.rb

Overview

Builds the ‘SourceFile::Method` objects for a source file from the raw method-coverage data. Applies the `ignore_methods :eval_generated` filter and marks methods inside `# simplecov:disable` / `# :nocov:` chunks as skipped.

Instance Method Summary collapse

Constructor Details

#initialize(source_file) ⇒ MethodBuilder

Returns a new instance of MethodBuilder.



10
11
12
# File 'lib/simplecov/source_file/method_builder.rb', line 10

def initialize(source_file)
  @source_file = source_file
end

Instance Method Details

#callObject



14
15
16
17
18
19
20
21
22
23
# File 'lib/simplecov/source_file/method_builder.rb', line 14

def call
  methods = @source_file.coverage_data.fetch("methods", {}).filter_map do |info, hit_count|
    info = RubyDataParser.call(info)
    next if eval_generated_to_ignore?(info)

    SourceFile::Method.new(@source_file, info, hit_count)
  end

  process_skipped(methods)
end