Class: Moult::Coverage::Dataset

Inherits:
Struct
  • Object
show all
Defined in:
lib/moult/coverage.rb

Overview

Normalised coverage: per (root-relative) path, the 0-indexed line array.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#entriesObject

Returns the value of attribute entries

Returns:

  • (Object)

    the current value of entries



38
39
40
# File 'lib/moult/coverage.rb', line 38

def entries
  @entries
end

#sourceObject

Returns the value of attribute source

Returns:

  • (Object)

    the current value of source



38
39
40
# File 'lib/moult/coverage.rb', line 38

def source
  @source
end

#unmatched_countObject

Returns the value of attribute unmatched_count

Returns:

  • (Object)

    the current value of unmatched_count



38
39
40
# File 'lib/moult/coverage.rb', line 38

def unmatched_count
  @unmatched_count
end

Instance Method Details

#line_value(path, line) ⇒ Integer?

Returns coverage value at that line, or nil if untracked.

Parameters:

  • line (Integer)

    1-based line number

Returns:

  • (Integer, nil)

    coverage value at that line, or nil if untracked



46
47
48
49
# File 'lib/moult/coverage.rb', line 46

def line_value(path, line)
  arr = entries[path]
  arr && arr[line - 1]
end

#tracked?(path) ⇒ Boolean

Returns whether this file appeared in the coverage dataset.

Returns:

  • (Boolean)

    whether this file appeared in the coverage dataset



40
41
42
# File 'lib/moult/coverage.rb', line 40

def tracked?(path)
  entries.key?(path)
end