class SyntaxTree::HshPtn::KeywordFormatter
Formats a key-value pair in a hash pattern. The value is optional.
Attributes
key[R]
Label
-
the keyword being used
value[R]
Node
-
the optional value for the keyword
Public Class Methods
new(key, value)
click to toggle source
# File lib/syntax_tree/node.rb, line 6003 def initialize(key, value) @key = key @value = value end
Public Instance Methods
comments()
click to toggle source
# File lib/syntax_tree/node.rb, line 6008 def comments [] end
format(q)
click to toggle source
# File lib/syntax_tree/node.rb, line 6012 def format(q) HashKeyFormatter::Labels.new.format_key(q, key) if value q.text(" ") q.format(value) end end