class

Crystal::Macros::Def

Inherits Crystal::Macros::ASTNode

A method definition.

Instance methods

abstract?

Returns true is this method is declared as abstract, false otherwise.

Source
accepts_block?

Returns true if this method can be called with a block, false otherwise.

Source
annotation(type : TypeNode) : Annotation | NilLiteral

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

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

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

Source
annotations

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

Source
args

Returns the arguments of this method.

Source
block_arg

Returns the block argument, if any.

Source
body

Returns the body of this method.

Source
double_splat

Returns the double splat argument, if any.

Source
free_vars

Returns the free variables of this method, or an empty ArrayLiteral if there are none.

Source
name

Returns the name of this method.

Source
receiver

Returns the receiver (for example self) of this method definition, or Nop if not specified.

Source
return_type

Returns the return type of the method, if specified.

Source
splat_index

Returns the index of the argument with a *splat, if any.

Source
visibility

Returns the visibility of this def: :public, :protected or :private.

Source