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



1776
1777
1778
1779
1780
1781
1782
1783
# File 'lib/syntax_tree/node.rb', line 1776

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