class

Myst::Block

Inherits Myst::Def / Myst::Node / Reference / Object

A block definition. Functionally, a block is equivalent to a method definition. The only difference being that a block is always unnamed. Syntax-wise, blocks appear as the last expression in a Call, and can be created either by a do...end construct or curly braces ({ ... }).

'do' [ '|' param [ ',' param ]* '|' ] body 'end' | '{' [ '|' param [ ',' param ]* '|' ] body '}'

Convention recommends that the brace form only be used for single-line blocks, and the do...end form only be used for multi-line blocks.

Constructors

new(params = [] of Param, body = Nop.new, *, return_type = nil, block_param = nil, splat_index = nil, style : Symbol = :brace)
Source

Instance methods

==(other : self)

Returns true if this reference is the same as other. Invokes same?.

hash(hasher)

See Object#hash(hasher)

style

Style should be :doend or :brace, respectively, based on the bracing style used, as shown above.

Source
style=(style : Symbol)

Style should be :doend or :brace, respectively, based on the bracing style used, as shown above.

Source