Class: SyntaxTree::HashKeyFormatter::Rockets
- Inherits:
-
Object
- Object
- SyntaxTree::HashKeyFormatter::Rockets
- Defined in:
- lib/syntax_tree/node.rb
Overview
Formats the keys of a hash literal using hash rockets.
Instance Method Summary collapse
Instance Method Details
#format_key(q, key) ⇒ Object
1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 |
# File 'lib/syntax_tree/node.rb', line 1424 def format_key(q, key) case key when Label q.text(":") q.text(key.value.chomp(":")) when DynaSymbol q.text(":") q.format(key) else q.format(key) end q.text(" =>") end |