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
-
#class ⇒ Object
This is here so that when checking if its contained within a parent pattern that it will return true.
- #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.
6549 6550 6551 6552 |
# File 'lib/syntax_tree.rb', line 6549 def initialize(key, value) @key = key @value = value end |
Instance Attribute Details
#key ⇒ Object (readonly)
- Label
-
the keyword being used
6544 6545 6546 |
# File 'lib/syntax_tree.rb', line 6544 def key @key end |
#value ⇒ Object (readonly)
- untyped
-
the optional value for the keyword
6547 6548 6549 |
# File 'lib/syntax_tree.rb', line 6547 def value @value end |
Instance Method Details
#class ⇒ Object
This is here so that when checking if its contained within a parent pattern that it will return true.
6556 6557 6558 |
# File 'lib/syntax_tree.rb', line 6556 def class HshPtn end |
#comments ⇒ Object
6560 6561 6562 |
# File 'lib/syntax_tree.rb', line 6560 def comments [] end |
#format(q) ⇒ Object
6564 6565 6566 6567 6568 6569 6570 6571 |
# File 'lib/syntax_tree.rb', line 6564 def format(q) q.format(key) if value q.text(" ") q.format(value) end end |