module
   Ameba::AST::Util
  
  Overview
Utility module for Ameba's rules.
Direct including types
- Ameba::AST::Branchable
- Ameba::AST::FlowExpression
- Ameba::AST::FlowExpressionVisitor
- Ameba::Reportable
- Ameba::Rule::Documentation::Admonition
- Ameba::Rule::Lint::AmbiguousAssignment
- Ameba::Rule::Lint::BadDirective
- Ameba::Rule::Lint::ComparisonToBoolean
- Ameba::Rule::Lint::EmptyLoop
- Ameba::Rule::Lint::LiteralAssignmentsInExpressions
- Ameba::Rule::Lint::LiteralInCondition
- Ameba::Rule::Lint::LiteralInInterpolation
- Ameba::Rule::Lint::LiteralsComparison
- Ameba::Rule::Lint::NotNilAfterNoBang
- Ameba::Rule::Lint::RedundantStringCoercion
- Ameba::Rule::Lint::SignalTrap
- Ameba::Rule::Lint::SpecEqWithBoolOrNilLiteral
- Ameba::Rule::Lint::SpecFocus
- Ameba::Rule::Lint::UnneededDisableDirective
- Ameba::Rule::Lint::UnusedBlockArgument
- Ameba::Rule::Lint::VoidOutsideLib
- Ameba::Rule::Lint::WhitespaceAroundMacroExpression
- Ameba::Rule::Naming::QueryBoolMethods
- Ameba::Rule::Naming::RescuedExceptionsVariableName
- Ameba::Rule::Performance::AnyAfterFilter
- Ameba::Rule::Performance::AnyInsteadOfEmpty
- Ameba::Rule::Performance::ChainedCallWithNoBang
- Ameba::Rule::Performance::CompactAfterMap
- Ameba::Rule::Performance::ExcessiveAllocations
- Ameba::Rule::Performance::FirstLastAfterFilter
- Ameba::Rule::Performance::FlattenAfterMap
- Ameba::Rule::Performance::MapInsteadOfBlock
- Ameba::Rule::Performance::MinMaxAfterMap
- Ameba::Rule::Performance::SizeAfterFilter
- Ameba::Rule::Style::GuardClause
- Ameba::Rule::Style::HeredocEscape
- Ameba::Rule::Style::IsAFilter
- Ameba::Rule::Style::IsANil
- Ameba::Rule::Style::LargeNumbers
- Ameba::Rule::Style::MultilineCurlyBlock
- Ameba::Rule::Style::RedundantBegin
- Ameba::Rule::Style::RedundantNext
- Ameba::Rule::Style::RedundantReturn
- Ameba::Rule::Style::RedundantSelf
- Ameba::Rule::Style::VerboseBlock
- Ameba::Rule::Typing::MethodParameterTypeRestriction
- Ameba::Rule::Typing::MethodReturnTypeRestriction
Defined in:
ameba/ast/util.crInstance Method Summary
- 
        #abort?(node)
        
          Returns trueif node representsabortmethod call.
- 
        #control_exp_code(node : Crystal::ControlExpression, code_lines)
        
          Returns the exp code of a control expression. 
- 
        #dynamic_literal?(node) : Bool
        
          Returns trueif currentnodeis a dynamic literal,falseotherwise.
- 
        #exit?(node)
        
          Returns trueif node representsexitmethod call.
- 
        #flow_command?(node, in_loop)
        
          Returns trueif node is a flow command,falseotherwise.
- 
        #flow_expression?(node, in_loop = false)
        
          Returns trueif node is a flow expression,falseif not.
- 
        #has_block?(node) : Bool
        
          Returns trueif the node is aCrystal::Callwith eithernode.blockornode.block_argset,falseotherwise.
- 
        #literal?(node) : Bool
        
          Returns trueif currentnodeis a literal,falseotherwise.
- 
        #loop?(node)
        
          Returns trueif node represents a loop.
- 
        #name_end_location(node)
        
          Returns nilif node does not contain a name.
- 
        #name_location(node)
        
          Returns nilif node does not contain a name.
- #name_location_or(token : Crystal::Token, name, *, adjust_location_column_number = nil)
- #name_location_or(node : Crystal::ASTNode, *, adjust_location_column_number = nil)
- 
        #name_size(node)
        
          Returns zero if node does not contain a name. 
- 
        #node_source(node, code_lines)
        
          Returns a source code for the current node. 
- 
        #nodoc?(node)
        
          Returns trueif node has a:nodoc:annotation as the first line.
- 
        #path_named?(node, *names : String) : Bool
        
          Returns trueif currentnodeis aCrystal::Pathmatching given name,falseotherwise.
- 
        #raise?(node)
        
          Returns trueif node representsraisemethod call.
- 
        #source_between(loc, end_loc, code_lines) : String | Nil
        
          Returns the source code from loc to end_loc (inclusive). 
- 
        #static_literal?(node) : Bool
        
          Returns trueif currentnodeis a static literal,falseotherwise.
Instance Method Detail
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.
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
endThis node is a not a flow expression:
if a > 0
  return :positive
endThat'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 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 true if current node is a Crystal::Path
matching given name, false otherwise.
Returns the source code from loc to end_loc (inclusive).
Returns true if current node is a static literal, false otherwise.