enum

CWE::Abstraction

Inherits Enum < Comparable < Value < Object

CWE catalog defines a small fixed set of abstraction levels. We expose them as an enum so callers can pattern-match against them; unknown values (catalog drift, future MITRE releases) map to Other.

Compound is a genuine member of MITRE's AbstractionEnumeration, not a synonym for Structure: the seven Compound entries (CWE-61, 352, 384, 680, 689, 690, 692) carry Abstraction="Compound" and a separate Structure of Chain or Composite.

Constants

Pillar = 0
Class = 1
Base = 2
Variant = 3
Compound = 4
Other = 5

Constructors

new(pull : JSON::PullParser) : Abstraction
Source
parse_label(s : String | Nil) : Abstraction
Source

Instance methods

base?

Returns true if this enum value equals Base

Source
class?

Returns true if this enum value equals Class

Source
compound?

Returns true if this enum value equals Compound

Source
other?

Returns true if this enum value equals Other

Source
pillar?

Returns true if this enum value equals Pillar

Source
to_json(json : JSON::Builder) : Nil

JSON uses the MITRE label ("Base"), matching to_s and the "abstraction"/"status"/… fields the library already emits — not Crystal's default underscored member name ("base"). Reading is as forgiving as parse_label: an unrecognised label becomes Other instead of raising, so a future MITRE value cannot break a decode.

Source
to_s(io : IO) : Nil

Appends a String representation of this enum member to the given io.

See also: to_s.

Source
to_s

Returns a String representation of this enum member. In the case of regular enums, this is just the name of the member. In the case of flag enums, it's the names joined by vertical bars, or "None", if the value is zero.

If an enum's value doesn't match a member's value, the raw value is returned as a string.

Color::Red.to_s                     # => "Red"
IOMode::None.to_s                   # => "None"
(IOMode::Read | IOMode::Write).to_s # => "Read | Write"

Color.new(10).to_s # => "10"
Source
variant?

Returns true if this enum value equals Variant

Source