Class: SimpleCov::Formatter::AIFormatter::MarkdownBuilder::MethodDeficit
- Inherits:
-
T::Struct
- Object
- T::Struct
- SimpleCov::Formatter::AIFormatter::MarkdownBuilder::MethodDeficit
- Extended by:
- T::Sig
- Defined in:
- lib/simplecov-ai/markdown_builder/deficit_group.rb
Overview
A method SimpleCov >= 1.0 reported as never invoked, captured in the formatter's own
shape so that no SimpleCov::SourceFile::Method constant (absent before 1.0) is ever
referenced at runtime.
Constant Summary collapse
- SINGLETON_OWNER_PATTERN =
The class name Ruby reports for the owner of a singleton method.
T.let(/\A#<Class:(.+)>\z/.freeze, Regexp)
Class Method Summary collapse
- .from_file(file) ⇒ Object
- .measured?(coverage_metrics) ⇒ Boolean
- .qualified_name(class_name, method_name) ⇒ Object
Instance Method Summary collapse
-
#end_line ⇒ Integer
The last line of the definition.
-
#method_name ⇒ String
The bare method name, without its owner.
-
#name ⇒ String
The method's semantic name (
Klass#nameorKlass.name). -
#start_line ⇒ Integer
The first line of the definition.
Class Method Details
.from_file(file) ⇒ Object
44 45 46 47 48 49 50 51 |
# File 'lib/simplecov-ai/markdown_builder/deficit_group.rb', line 44 def self.from_file(file) missed_methods = (file.respond_to?(:missed_methods) && file.missed_methods) || [] missed_methods.map do |missed_method| method_name = missed_method.method_name.to_s new(name: qualified_name(missed_method.class_name.to_s, method_name), method_name: method_name, start_line: missed_method.start_line, end_line: missed_method.end_line) end end |
.measured?(coverage_metrics) ⇒ Boolean
34 35 36 |
# File 'lib/simplecov-ai/markdown_builder/deficit_group.rb', line 34 def self.measured?(coverage_metrics) coverage_metrics.respond_to?(:total_methods) && !coverage_metrics.total_methods.nil? end |
.qualified_name(class_name, method_name) ⇒ Object
60 61 62 63 |
# File 'lib/simplecov-ai/markdown_builder/deficit_group.rb', line 60 def self.qualified_name(class_name, method_name) singleton_owner = class_name[SINGLETON_OWNER_PATTERN, 1] singleton_owner ? "#{singleton_owner}.#{method_name}" : "#{class_name}##{method_name}" end |
Instance Method Details
#end_line ⇒ Integer
Returns The last line of the definition.
24 |
# File 'lib/simplecov-ai/markdown_builder/deficit_group.rb', line 24 const :end_line, Integer |
#method_name ⇒ String
Returns The bare method name, without its owner.
20 |
# File 'lib/simplecov-ai/markdown_builder/deficit_group.rb', line 20 const :method_name, String |
#name ⇒ String
Returns The method's semantic name (Klass#name or Klass.name).
18 |
# File 'lib/simplecov-ai/markdown_builder/deficit_group.rb', line 18 const :name, String |
#start_line ⇒ Integer
Returns The first line of the definition.
22 |
# File 'lib/simplecov-ai/markdown_builder/deficit_group.rb', line 22 const :start_line, Integer |