Module: SimpleCov::GroupNames

Defined in:
lib/simplecov/group_names.rb,
sig/simplecov.rbs

Overview

Semantic names owned by result processing rather than user configuration.

Constant Summary collapse

UNGROUPED =

Returns:

  • (String)
"Ungrouped"

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.normalize(group_name) ⇒ Object

Group names are Hash keys, report labels, and JSON object keys all at once, so they are normalized to Strings up front: a Symbol spelling (group :Controllers) means the String, and anything else has no sensible serialized form. Normalizing before validate! also keeps group :Ungrouped from slipping past the reservation below.



15
16
17
18
19
20
21
22
23
# File 'lib/simplecov/group_names.rb', line 15

def normalize(group_name)
  case group_name
  when String then group_name
  when Symbol then group_name.to_s
  else
    raise SimpleCov::ConfigurationError,
          "Group names must be Strings, got #{group_name.inspect} (#{group_name.class})"
  end
end

.validate!(group_names) ⇒ Object



25
26
27
28
29
30
# File 'lib/simplecov/group_names.rb', line 25

def validate!(group_names)
  return group_names unless group_names.include?(UNGROUPED)

  raise SimpleCov::ConfigurationError,
        "#{UNGROUPED.inspect} is reserved for files that do not match a configured group"
end

Instance Method Details

#self?.normalizeString

Parameters:

  • group_name (Object)

Returns:

  • (String)


24
# File 'sig/simplecov.rbs', line 24

def self?.normalize: (untyped group_name) -> String

#self?.validate!Array[String]

Parameters:

  • group_names (Array[String])

Returns:

  • (Array[String])


26
# File 'sig/simplecov.rbs', line 26

def self?.validate!: (Array[String] group_names) -> Array[String]