Module: Jade::Formatter::FunctionDeclaration

Extended by:
FunctionDeclaration, Helper
Included in:
FunctionDeclaration
Defined in:
lib/jade/formatter/function_declaration.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



7
8
9
10
11
12
13
14
15
16
17
# File 'lib/jade/formatter/function_declaration.rb', line 7

def format(node, indent:, source:)
  node => AST::FunctionDeclaration(
    name:, params:, return_type:, body:
  )

  [
    format_signature(name, params, return_type, indent, source:),
    format_node(body, indent: indent + 1, source:),
    "end".then(&and_indent(indent)),
  ].join("\n")
end