Class: Ruby::Merge::NocovWrapperBase

Inherits:
Object
  • Object
show all
Includes:
Ast::Merge::BlockDirective
Defined in:
lib/ruby/merge/nocov_wrapper_base.rb

Overview

Shared Ruby wrapper for nodes carrying unbalanced or inline nocov markers.

The wrapped parser node remains responsible for structural identity; this wrapper only marks it as a Ruby coverage directive participant.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(node, merge_type = :nocov) ⇒ NocovWrapperBase

Returns a new instance of NocovWrapperBase.



14
15
16
17
# File 'lib/ruby/merge/nocov_wrapper_base.rb', line 14

def initialize(node, merge_type = :nocov)
  @node = node
  @merge_type = merge_type
end

Instance Attribute Details

#merge_typeObject (readonly)

Returns the value of attribute merge_type.



12
13
14
# File 'lib/ruby/merge/nocov_wrapper_base.rb', line 12

def merge_type
  @merge_type
end

#nodeObject (readonly)

Returns the value of attribute node.



12
13
14
# File 'lib/ruby/merge/nocov_wrapper_base.rb', line 12

def node
  @node
end

Instance Method Details

#block_directive?Boolean

Returns:

  • (Boolean)


39
# File 'lib/ruby/merge/nocov_wrapper_base.rb', line 39

def block_directive? = true

#childrenObject



20
# File 'lib/ruby/merge/nocov_wrapper_base.rb', line 20

def children = []

#end_lineObject



27
28
29
# File 'lib/ruby/merge/nocov_wrapper_base.rb', line 27

def end_line
  @node.location&.end_line
end

#inspectObject



41
42
43
# File 'lib/ruby/merge/nocov_wrapper_base.rb', line 41

def inspect
  "#<#{self.class} merge_type=#{@merge_type.inspect} node=#{@node.inspect}>"
end

#kindObject



19
# File 'lib/ruby/merge/nocov_wrapper_base.rb', line 19

def kind = :nocov

#locationObject



33
# File 'lib/ruby/merge/nocov_wrapper_base.rb', line 33

def location = @node.location

#merge_policyObject



21
# File 'lib/ruby/merge/nocov_wrapper_base.rb', line 21

def merge_policy = nil

#nocov_node?Boolean

Returns:

  • (Boolean)


38
# File 'lib/ruby/merge/nocov_wrapper_base.rb', line 38

def nocov_node? = false

#nocov_wrapper?Boolean

Returns:

  • (Boolean)


37
# File 'lib/ruby/merge/nocov_wrapper_base.rb', line 37

def nocov_wrapper? = true

#sliceObject



35
# File 'lib/ruby/merge/nocov_wrapper_base.rb', line 35

def slice = @node.slice

#start_lineObject



23
24
25
# File 'lib/ruby/merge/nocov_wrapper_base.rb', line 23

def start_line
  @node.location&.start_line
end

#unwrapObject



31
# File 'lib/ruby/merge/nocov_wrapper_base.rb', line 31

def unwrap = @node