Module: Jade::Formatter::InteropImportDeclaration

Extended by:
Helper, InteropImportDeclaration
Included in:
InteropImportDeclaration
Defined in:
lib/jade/formatter/declarations.rb

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



111
112
113
114
115
116
117
118
119
120
121
122
123
# File 'lib/jade/formatter/declarations.rb', line 111

def format(node, indent:, source:)
  node => AST::InteropImportDeclaration(module: interop_module, functions:)

  funcs_str = functions
    .map { format_node(it, source:).then(&and_indent(indent + 1)) }
    .join(",\n")

  [
    "uses #{interop_module.name} with".then(&and_indent(indent)),
    funcs_str,
    "end".then(&and_indent(indent)),
  ].join("\n")
end