Method: SyntaxTree::Call#format

Defined in:
lib/syntax_tree/node.rb

#format(q) ⇒ Object



2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
# File 'lib/syntax_tree/node.rb', line 2527

def format(q)
  # If we're at the top of a call chain, then we're going to do some
  # specialized printing in case we can print it nicely. We _only_ do this
  # at the top of the chain to avoid weird recursion issues.
  if !CallChainFormatter.chained?(q.parent) && CallChainFormatter.chained?(receiver)
    q.group { q.if_break { CallChainFormatter.new(self).format(q) }.if_flat { format_contents(q) } }
  else
    format_contents(q)
  end
end