class

Crystal::Macros::Arg

Inherits Crystal::Macros::ASTNode

A def argument.

Instance methods

annotation(type : TypeNode) : Annotation | NilLiteral

Returns the last Annotation with the given type attached to this arg or NilLiteral if there are none.

Source
annotations(type : TypeNode) : ArrayLiteral(Annotation)

Returns an array of annotations with the given type attached to this arg, or an empty ArrayLiteral if there are none.

Source
annotations

Returns an array of all annotations attached to this arg, or an empty ArrayLiteral if there are none.

Source
default_value

Returns the default value of this argument, if any.

Source
internal_name

Returns the internal name of this argument.

For example, for def write(to file) returns file.

Source
name

Returns the external name of this argument.

For example, for def write(to file) returns to.

Source
restriction

Returns the type restriction of this argument, if any.

Source