Module: SimpleCov::GroupNames
- Extended by:
- GroupNames
- Included in:
- GroupNames
- Defined in:
- lib/simplecov/group_names.rb,
sig/simplecov.rbs
Constant Summary collapse
- UNGROUPED =
"Ungrouped"
Instance Method Summary collapse
-
#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 means the String, and anything else has no sensible serialized form.
- #self?.normalize ⇒ String
- #self?.validate! ⇒ Array[String]
-
#validate!(group_names) ⇒ Object
Each name in turn, rather than asking the collection: a String asked whether it "includes" the reserved name answers about its own characters.
Instance 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 means the
String, and anything else has no sensible serialized form. Normalizing
before validate! also keeps group :Ungrouped from slipping past the
reservation below.
14 15 16 17 18 19 20 21 22 |
# File 'lib/simplecov/group_names.rb', line 14 def normalize(group_name) case group_name when String then group_name when Symbol then group_name.to_s else raise ConfigurationError, "Group names must be Strings, got #{group_name.inspect} (#{group_name.class})" end end |
#self?.normalize ⇒ String
15 |
# File 'sig/simplecov.rbs', line 15
def self?.normalize: (untyped group_name) -> String
|
#self?.validate! ⇒ Array[String]
17 |
# File 'sig/simplecov.rbs', line 17
def self?.validate!: (Array[String] group_names) -> Array[String]
|
#validate!(group_names) ⇒ Object
Each name in turn, rather than asking the collection: a String asked whether it "includes" the reserved name answers about its own characters.
26 27 28 29 30 31 |
# File 'lib/simplecov/group_names.rb', line 26 def validate!(group_names) return group_names unless group_names.any? { |name| name.eql?(UNGROUPED) } raise ConfigurationError, "#{UNGROUPED.inspect} is reserved for files that do not match a configured group" end |