Crystal::Macros::ClassDef
Inherits Crystal::Macros::ASTNode
A class definition.
Every class definition node is equivalent to:
{% begin %}
{% "abstract".id if node.abstract? %} {{ node.kind }} {{ node.name }} {% if superclass = node.superclass %}< {{ superclass }}{% end %}
{{ node.body }}
end
{% end %}
Instance methods
kind
Returns the keyword used to define this type.
For ClassDef this is either class or struct.
Returns the name of this type definition.
If this node defines a generic type, and generic_args is true, returns a
Generic whose type arguments are MacroIds, possibly with a Splat at
the splat index. Otherwise, this method returns a Path.
splat_index
Returns the splat index of this type definition's generic type parameters.
Returns nil if this type definition isn't generic or if there isn't a
splat parameter.
type_vars
Returns an array of MacroIds of this type definition's generic type
parameters.
On a non-generic type definition, returns an empty array.