Class: SyntaxTree::HashKeyFormatter::Identity

Inherits:
Object
  • Object
show all
Defined in:
lib/syntax_tree/node.rb

Overview

When formatting a single assoc node without the context of the parent hash, this formatter is used. It uses whatever is present in the node, because there is nothing to be consistent with.

Instance Method Summary collapse

Instance Method Details

#format_key(q, key) ⇒ Object



1772
1773
1774
1775
1776
1777
1778
1779
# File 'lib/syntax_tree/node.rb', line 1772

def format_key(q, key)
  if key.is_a?(Label)
    q.format(key)
  else
    q.format(key)
    q.text(" =>")
  end
end