class Crystal::Macros::Def
inherits Crystal::Macros::ASTNode
¶
A method definition.
Methods¶
#accepts_block? : BoolLiteral
¶
: BoolLiteral
Returns true if this method can be called with a block, false otherwise.
#annotation(type : TypeNode) : Annotation | NilLiteral
¶
(type : TypeNode) : Annotation | NilLiteral
Returns the last Annotation with the given type
attached to this variable or NilLiteral if there are none.
#annotations(type : TypeNode) : ArrayLiteral(Annotation)
¶
(type : TypeNode) : ArrayLiteral(Annotation)
Returns an array of annotations with the given type
attached to this variable, or an empty ArrayLiteral if there are none.
#receiver : ASTNode | Nop
¶
: ASTNode | Nop
Returns the receiver (for example self) of this method definition,
or Nop if not specified.
#splat_index : NumberLiteral | NilLiteral
¶
: NumberLiteral | NilLiteral
Returns the index of the argument with a *splat, if any.
#visibility : SymbolLiteral
¶
: SymbolLiteral
Returns the visibility of this def: :public, :protected or :private.