Class: SimpleCov::Formatter::AIFormatter::ASTResolver::SemanticNode

Inherits:
Object
  • Object
show all
Extended by:
T::Sig
Defined in:
lib/simplecov-ai/ast_resolver/semantic_node.rb

Overview

An immutable struct housing bounds, identification metrics, and static bypassing definitions derived from traversing the AST nodes.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name:, type:, start_line:, end_line:, bypass_reasons: []) ⇒ SemanticNode

Returns a new instance of SemanticNode.



31
32
33
34
35
36
37
# File 'lib/simplecov-ai/ast_resolver/semantic_node.rb', line 31

def initialize(name:, type:, start_line:, end_line:, bypass_reasons: [])
  @name = name
  @type = type
  @start_line = start_line
  @end_line = end_line
  @bypass_reasons = bypass_reasons
end

Instance Attribute Details

#bypass_reasonsObject (readonly)

Returns the value of attribute bypass_reasons.



20
21
22
# File 'lib/simplecov-ai/ast_resolver/semantic_node.rb', line 20

def bypass_reasons
  @bypass_reasons
end

#end_lineObject (readonly)

Returns the value of attribute end_line.



17
18
19
# File 'lib/simplecov-ai/ast_resolver/semantic_node.rb', line 17

def end_line
  @end_line
end

#nameObject (readonly)

Returns the value of attribute name.



14
15
16
# File 'lib/simplecov-ai/ast_resolver/semantic_node.rb', line 14

def name
  @name
end

#start_lineObject (readonly)

Returns the value of attribute start_line.



17
18
19
# File 'lib/simplecov-ai/ast_resolver/semantic_node.rb', line 17

def start_line
  @start_line
end

#typeObject (readonly)

Returns the value of attribute type.



14
15
16
# File 'lib/simplecov-ai/ast_resolver/semantic_node.rb', line 14

def type
  @type
end

Instance Method Details

#add_bypass(bypass_reason) ⇒ Object



40
41
42
# File 'lib/simplecov-ai/ast_resolver/semantic_node.rb', line 40

def add_bypass(bypass_reason)
  @bypass_reasons << bypass_reason
end