Class: SyntaxTree::Params::KeywordFormatter
- Inherits:
-
Object
- Object
- SyntaxTree::Params::KeywordFormatter
- Defined in:
- lib/syntax_tree/node.rb
Overview
Formats the keyword position of the parameters. This includes the label, as well as an optional default value.
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
[Ident] the name of the parameter.
-
#value ⇒ Object
readonly
[nil | untyped] the value of the parameter.
Instance Method Summary collapse
- #comments ⇒ Object
- #format(q) ⇒ Object
-
#initialize(name, value) ⇒ KeywordFormatter
constructor
A new instance of KeywordFormatter.
Constructor Details
#initialize(name, value) ⇒ KeywordFormatter
Returns a new instance of KeywordFormatter.
6754 6755 6756 6757 |
# File 'lib/syntax_tree/node.rb', line 6754 def initialize(name, value) @name = name @value = value end |
Instance Attribute Details
#name ⇒ Object (readonly)
[Ident] the name of the parameter
6749 6750 6751 |
# File 'lib/syntax_tree/node.rb', line 6749 def name @name end |
#value ⇒ Object (readonly)
[nil | untyped] the value of the parameter
6752 6753 6754 |
# File 'lib/syntax_tree/node.rb', line 6752 def value @value end |
Instance Method Details
#comments ⇒ Object
6759 6760 6761 |
# File 'lib/syntax_tree/node.rb', line 6759 def comments [] end |
#format(q) ⇒ Object
6763 6764 6765 6766 6767 6768 6769 6770 |
# File 'lib/syntax_tree/node.rb', line 6763 def format(q) q.format(name) if value q.text(" ") q.format(value) end end |