Class: SyntaxTree::HshPtn::KeywordFormatter
- Inherits:
-
Object
- Object
- SyntaxTree::HshPtn::KeywordFormatter
- Defined in:
- lib/syntax_tree/node.rb
Instance Attribute Summary collapse
-
#key ⇒ Object
readonly
- Label
-
the keyword being used.
-
#value ⇒ Object
readonly
- untyped
-
the optional value for the keyword.
Instance Method Summary collapse
- #comments ⇒ Object
- #format(q) ⇒ Object
-
#initialize(key, value) ⇒ KeywordFormatter
constructor
A new instance of KeywordFormatter.
Constructor Details
#initialize(key, value) ⇒ KeywordFormatter
Returns a new instance of KeywordFormatter.
5765 5766 5767 5768 |
# File 'lib/syntax_tree/node.rb', line 5765 def initialize(key, value) @key = key @value = value end |
Instance Attribute Details
#key ⇒ Object (readonly)
- Label
-
the keyword being used
5760 5761 5762 |
# File 'lib/syntax_tree/node.rb', line 5760 def key @key end |
#value ⇒ Object (readonly)
- untyped
-
the optional value for the keyword
5763 5764 5765 |
# File 'lib/syntax_tree/node.rb', line 5763 def value @value end |
Instance Method Details
#comments ⇒ Object
5770 5771 5772 |
# File 'lib/syntax_tree/node.rb', line 5770 def comments [] end |
#format(q) ⇒ Object
5774 5775 5776 5777 5778 5779 5780 5781 |
# File 'lib/syntax_tree/node.rb', line 5774 def format(q) q.format(key) if value q.text(" ") q.format(value) end end |