Module: Jade::Formatter::ImportDeclaration

Extended by:
Helper, ImportDeclaration
Included in:
ImportDeclaration
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



96
97
98
99
100
101
102
103
104
# File 'lib/jade/formatter/declarations.rb', line 96

def format(node, indent:, source:)
  node => AST::ImportDeclaration(module_name:, as:, exposing:)

  parts = ["import #{module_name}"]
  parts << "as #{as.as}" if as
  parts << format_exposing(exposing) unless exposing in AST::ExposeNone | nil

  parts.join(' ').then(&and_indent(indent))
end