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.
4458 4459 4460 4461 |
# File 'lib/syntax_tree/node.rb', line 4458 def initialize(key, value) @key = key @value = value end |
Instance Attribute Details
#key ⇒ Object (readonly)
- Label
-
the keyword being used
4453 4454 4455 |
# File 'lib/syntax_tree/node.rb', line 4453 def key @key end |
#value ⇒ Object (readonly)
- untyped
-
the optional value for the keyword
4456 4457 4458 |
# File 'lib/syntax_tree/node.rb', line 4456 def value @value end |
Instance Method Details
#comments ⇒ Object
4463 4464 4465 |
# File 'lib/syntax_tree/node.rb', line 4463 def comments [] end |
#format(q) ⇒ Object
4467 4468 4469 4470 4471 4472 4473 4474 |
# File 'lib/syntax_tree/node.rb', line 4467 def format(q) q.format(key) if value q.text(" ") q.format(value) end end |