Class: Docscribe::CLI::Coverage::CoverageStats

Inherits:
Struct
  • Object
show all
Defined in:
lib/docscribe/cli/coverage.rb,
lib/docscribe/cli/coverage.rb

Overview

Struct tracking documentation coverage metrics per file.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#documented_methodsInteger

Parameters:

  • value (Integer)

Returns:

  • (Integer)


43
44
45
46
47
48
# File 'lib/docscribe/cli/coverage.rb', line 43

CoverageStats = Struct.new(
  :total_methods, :documented_methods,
  :total_params, :documented_params,
  :total_returns, :documented_returns,
  keyword_init: true
)

#documented_paramsInteger

Parameters:

  • value (Integer)

Returns:

  • (Integer)


43
44
45
46
47
48
# File 'lib/docscribe/cli/coverage.rb', line 43

CoverageStats = Struct.new(
  :total_methods, :documented_methods,
  :total_params, :documented_params,
  :total_returns, :documented_returns,
  keyword_init: true
)

#documented_returnsInteger

Parameters:

  • value (Integer)

Returns:

  • (Integer)


43
44
45
46
47
48
# File 'lib/docscribe/cli/coverage.rb', line 43

CoverageStats = Struct.new(
  :total_methods, :documented_methods,
  :total_params, :documented_params,
  :total_returns, :documented_returns,
  keyword_init: true
)

#total_methodsInteger

Parameters:

  • value (Integer)

Returns:

  • (Integer)


43
44
45
46
47
48
# File 'lib/docscribe/cli/coverage.rb', line 43

CoverageStats = Struct.new(
  :total_methods, :documented_methods,
  :total_params, :documented_params,
  :total_returns, :documented_returns,
  keyword_init: true
)

#total_paramsInteger

Parameters:

  • value (Integer)

Returns:

  • (Integer)


43
44
45
46
47
48
# File 'lib/docscribe/cli/coverage.rb', line 43

CoverageStats = Struct.new(
  :total_methods, :documented_methods,
  :total_params, :documented_params,
  :total_returns, :documented_returns,
  keyword_init: true
)

#total_returnsInteger

Parameters:

  • value (Integer)

Returns:

  • (Integer)


43
44
45
46
47
48
# File 'lib/docscribe/cli/coverage.rb', line 43

CoverageStats = Struct.new(
  :total_methods, :documented_methods,
  :total_params, :documented_params,
  :total_returns, :documented_returns,
  keyword_init: true
)

Instance Method Details

#method_coverageInteger, Float

Returns:

  • (Integer, Float)


53
54
55
# File 'lib/docscribe/cli/coverage.rb', line 53

def method_coverage
  total_methods.zero? ? 100.0 : (documented_methods.to_f / total_methods * 100).round(1)
end

#param_coverageInteger, Float

Returns:

  • (Integer, Float)


58
59
60
# File 'lib/docscribe/cli/coverage.rb', line 58

def param_coverage
  total_params.zero? ? 100.0 : (documented_params.to_f / total_params * 100).round(1)
end

#return_coverageInteger, Float

Returns:

  • (Integer, Float)


63
64
65
# File 'lib/docscribe/cli/coverage.rb', line 63

def return_coverage
  total_returns.zero? ? 100.0 : (documented_returns.to_f / total_returns * 100).round(1)
end