Skip to content

class Crystal::ExhaustivenessChecker::EnumTarget
inherits Crystal::ExhaustivenessChecker::Target

An enum target. Subtargets are the enum members.

Class methods

.new(type)

View source

Methods

#add_subtargets(type_groups : Array(Array(Type)), index : Int32) : Nil

Add subtargets for the given type groups, starting at index.

View source

#cover(patterns : Array(Pattern), index : Int32) : Nil

Covers this target and subsequent subtargets with the patterns starting at index.

View source

#cover(pattern : Pattern) : Nil

Tries to cover this target with the given pattern. By default, a TypePattern will cover a target. Other, more specific, patterns will partially cover a target.

View source

#covered? : Bool

Was this target covered?

View source

#members : Array(Const)

View source

#missing_cases : Array(String)

What are the cases that we didn't cover?

View source

#reject_covered! : Bool

Removes covered subtargets from this target, and returns whether this target ended up being entirely covered.

View source

#subtargets : Hash(Const, Array(Target))

#subtargets=(subtargets : Hash(Const, Array(Target)))

View source

#subtargets? : Hash(Const, Array(Target))?