class SyntaxTree::HashKeyFormatter::Rockets

Formats the keys of a hash literal using hash rockets.

Public Instance Methods

format_key(q, key) click to toggle source
# File lib/syntax_tree/node.rb, line 1757
def format_key(q, key)
  case key
  when Label
    q.text(":#{key.value.chomp(":")}")
  when DynaSymbol
    q.text(":")
    q.format(key)
  else
    q.format(key)
  end

  q.text(" =>")
end