Class: SyntaxTree::HshPtn::KeywordFormatter
- Inherits:
-
Object
- Object
- SyntaxTree::HshPtn::KeywordFormatter
- Defined in:
- lib/syntax_tree.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.
6596 6597 6598 6599 |
# File 'lib/syntax_tree.rb', line 6596 def initialize(key, value) @key = key @value = value end |
Instance Attribute Details
#key ⇒ Object (readonly)
- Label
-
the keyword being used
6591 6592 6593 |
# File 'lib/syntax_tree.rb', line 6591 def key @key end |
#value ⇒ Object (readonly)
- untyped
-
the optional value for the keyword
6594 6595 6596 |
# File 'lib/syntax_tree.rb', line 6594 def value @value end |
Instance Method Details
#comments ⇒ Object
6601 6602 6603 |
# File 'lib/syntax_tree.rb', line 6601 def comments [] end |
#format(q) ⇒ Object
6605 6606 6607 6608 6609 6610 6611 6612 |
# File 'lib/syntax_tree.rb', line 6605 def format(q) q.format(key) if value q.text(" ") q.format(value) end end |