View Source Credo.Code.Block (Credo v1.6.4)

This module provides helper functions to analyse blocks, e.g. the block taken by the if macro.

Link to this section Summary

Functions

Returns true if the given ast has an after block.

Returns a tuple {:ok, after_block} or nil for a given AST node.

Returns the after: block of a given AST node.

Returns the do: block of a given AST node.

Returns the children of the catch block of the given AST node.

Returns the children of the do block of the given AST node.

Returns the children of the rescue block of the given AST node.

Returns true if the given ast has an catch block.

Returns a tuple {:ok, catch_block} or nil for a given AST node.

Returns the catch: block of a given AST node.

Returns true if the given ast has a do block.

Returns a tuple {:ok, do_block} or nil for a given AST node.

Returns the do: block of a given AST node.

Returns true if the given ast has an else block.

Returns a tuple {:ok, else_block} or nil for a given AST node.

Returns the else block of a given AST node.

Returns true if the given ast has an rescue block.

Returns a tuple {:ok, rescue_block} or nil for a given AST node.

Returns the rescue: block of a given AST node.

Link to this section Functions

Returns true if the given ast has an after block.

Link to this function

after_block_for(arguments)

View Source

Returns a tuple {:ok, after_block} or nil for a given AST node.

Returns the after: block of a given AST node.

Returns the do: block of a given AST node.

Link to this function

calls_in_catch_block(arg)

View Source

Returns the children of the catch block of the given AST node.

Returns the children of the do block of the given AST node.

Link to this function

calls_in_rescue_block(arg)

View Source

Returns the children of the rescue block of the given AST node.

Returns true if the given ast has an catch block.

Link to this function

catch_block_for(arguments)

View Source

Returns a tuple {:ok, catch_block} or nil for a given AST node.

Returns the catch: block of a given AST node.

Returns true if the given ast has a do block.

Returns a tuple {:ok, do_block} or nil for a given AST node.

Returns the do: block of a given AST node.

Returns true if the given ast has an else block.

Link to this function

else_block_for(arguments)

View Source

Returns a tuple {:ok, else_block} or nil for a given AST node.

Returns the else block of a given AST node.

Returns true if the given ast has an rescue block.

Link to this function

rescue_block_for(arguments)

View Source

Returns a tuple {:ok, rescue_block} or nil for a given AST node.

Returns the rescue: block of a given AST node.