Module: Jade::Formatter::Tuple

Extended by:
Helper, Tuple
Included in:
Tuple
Defined in:
lib/jade/formatter/collections.rb

Overview

Tuple / List share the open-sep-close shape (delegated to ‘format_delimited`). RecordLiteral / RecordUpdate are similar but carry field-shaped contents and an open-brace prelude.

Instance Method Summary collapse

Methods included from Helper

and_indent, dispatch_for, format_delimited, format_exposing, format_leading_comments, format_node, format_pattern, format_trailing_comment, format_type, format_type_atom, too_long?

Instance Method Details

#format(node, indent:, source:) ⇒ Object



11
12
13
14
15
16
17
18
# File 'lib/jade/formatter/collections.rb', line 11

def format(node, indent:, source:)
  node => AST::Tuple(items:, trailing_comma:)

  format_delimited(
    items.map { format_node(it, source:) },
    '(', ')', trailing_comma, indent,
  )
end