Ameba::AST::Util
Utility module for Ameba's rules.
Instance methods
Returns the exp code of a control expression. Wraps implicit tuple literal with curly brackets (e.g. multi-return).
Returns true if current node is a dynamic literal, false otherwise.
Yields each inline directive found in the source.
Returns true if node is a flow command, false otherwise.
Node represents a flow command if it is a control expression,
or special call node that interrupts execution (i.e. raise, exit, abort).
Returns true if node is a flow expression, false if not.
Node represents a flow expression if it is full-filled by a flow command.
For example, this node is a flow expression, because each branch contains
a flow command return:
if a > 0
return :positive
elsif a < 0
return :negative
else
return :zero
end
This node is a not a flow expression:
if a > 0
return :positive
end
That's because not all branches return(i.e. else is missing).
Returns true if the node is a Crystal::Call
with either node.block or node.block_arg set, false otherwise.
Returns true if the node is a Crystal::Call
with either node.block or node.block_arg set, false otherwise.
Returns true if node is a call with a short block version (&.foo?).
Returns true if node is a heredoc, false otherwise.
Returns nil if node does not contain a name.
NOTE: Use this instead of Crystal::Call#name_end_location to avoid an
off-by-one error.
Returns a source code for the current node.
This method uses node.location and node.end_location
to determine and cut a piece of source of the node.
Returns the path name of the path.
If include_global is true (default), the global prefix :: is included.
Returns true if current node is a Crystal::Path
matching given name, false otherwise.
Returns true if node represents a short block version (&.foo?).
Returns the source code from loc to end_loc (inclusive).